本文整理匯總了Java中net.minecraft.util.MathHelper.func_76142_g方法的典型用法代碼示例。如果您正苦於以下問題:Java MathHelper.func_76142_g方法的具體用法?Java MathHelper.func_76142_g怎麽用?Java MathHelper.func_76142_g使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.util.MathHelper
的用法示例。
在下文中一共展示了MathHelper.func_76142_g方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getRotationsNeeded
import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
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};
}
示例2: getIncrementedRotation
import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
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;
}