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

The following are Jave code examples for showing how to use func_76142_g() 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};
}
 
Example 2
Project: bit-client   File: AngleUtil.java   Source Code and License Vote up 4 votes
public static float getIncrementedRotation(float currentRotation, float targetRotation, float increment) {
    float deltaAngle = MathHelper.func_76142_g(targetRotation - currentRotation);
    if (deltaAngle > increment) deltaAngle = increment;
    if (deltaAngle < -increment) deltaAngle = -increment;
    return deltaAngle;
}