本文整理汇总了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;
}