Java Code Examples for net.minecraft.util.MathHelper.func_76133_a()

The following are Jave code examples for showing how to use func_76133_a() of the net.minecraft.util.MathHelper class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: bit-client   File: AngleUtil.java   Source Code and License Vote up 5 votes
public static float[] getRotationsNeeded(double x, double y, double z) {
    double deltaX = x - Wrapper.getPosX(Wrapper.thePlayer());
    double deltaY = y - (Wrapper.getPosY(Wrapper.thePlayer()) + Wrapper.thePlayer().func_70047_e());
    double deltaZ = z - Wrapper.getPosZ(Wrapper.thePlayer());

    double theta = MathHelper.func_76133_a(deltaX * deltaX + deltaZ * deltaZ);
    float yaw = (float) Math.toDegrees(Math.atan2(deltaZ, deltaX)) - 90.0F;
    float pitch = (float) -Math.toDegrees(Math.atan2(deltaY, theta));
    return new float[]{
            (Wrapper.player_rotationYaw() + MathHelper.func_76142_g(yaw - Wrapper.player_rotationYaw())) % 360.0F,
            (Wrapper.player_rotationPitch() + MathHelper.func_76142_g(pitch - Wrapper.player_rotationPitch()))
                    % 360.0F};
}