public static int getEntityRotation ( Entity entity , boolean sixWays ) { if ( entity == null ) return 6 ; float pitch = entity . rotationPitch ; if ( sixWays && pitch < - 45 ) return 4 ; if ( sixWays && pitch > 45 ) return 5 ; return ( MathHelper . floor ( entity . rotationYaw * 4.0F / 360.0F + 0.5D ) + 2 ) & 3 ; }
Gets the entity rotation based on where it s currently facing .