本文整理汇总了Java中net.minecraft.util.MathHelper.wrapAngleTo180_double方法的典型用法代码示例。如果您正苦于以下问题:Java MathHelper.wrapAngleTo180_double方法的具体用法?Java MathHelper.wrapAngleTo180_double怎么用?Java MathHelper.wrapAngleTo180_double使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.util.MathHelper
的用法示例。
在下文中一共展示了MathHelper.wrapAngleTo180_double方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMovementOffsets
import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
/**
* Returns a double[3] array with movement offsets, used to calculate trailing tail/neck positions. [0] = yaw
* offset, [1] = y offset, [2] = unused, always 0. Parameters: buffer index offset, partial ticks.
*/
public double[] getMovementOffsets(int p_70974_1_, float p_70974_2_)
{
if (this.getHealth() <= 0.0F)
{
p_70974_2_ = 0.0F;
}
p_70974_2_ = 1.0F - p_70974_2_;
int i = this.ringBufferIndex - p_70974_1_ * 1 & 63;
int j = this.ringBufferIndex - p_70974_1_ * 1 - 1 & 63;
double[] adouble = new double[3];
double d0 = this.ringBuffer[i][0];
double d1 = MathHelper.wrapAngleTo180_double(this.ringBuffer[j][0] - d0);
adouble[0] = d0 + d1 * (double)p_70974_2_;
d0 = this.ringBuffer[i][1];
d1 = this.ringBuffer[j][1] - d0;
adouble[1] = d0 + d1 * (double)p_70974_2_;
adouble[2] = this.ringBuffer[i][2] + (this.ringBuffer[j][2] - this.ringBuffer[i][2]) * (double)p_70974_2_;
return adouble;
}
示例2: adjustAim
import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public static void adjustAim(Entity_AA turret, boolean secondRail, double posX, double posY, double posZ)
{
_WeaponBase currentWeapon = turret.firstWeapon;
if (secondRail) { currentWeapon = turret.secondWeapon; }
if (currentWeapon == null) { return; } // Has no weapon, so no point in adjusting anything
if (currentWeapon instanceof LightningRed) { } // Laser
else if (currentWeapon instanceof MediGun) { }
else if (currentWeapon instanceof Sunray) { }
else if (currentWeapon instanceof ERA) { }
else if (currentWeapon instanceof Endernymous) { }
else
{
double distance = getDistanceSqToTarget(turret, posX, posY, posZ);
double angleMod = (0.045 * distance) / (currentWeapon.Speed * currentWeapon.Speed); // 0.05
if (currentWeapon instanceof FrostLancer) { angleMod /= 2; } // Half gravity
else if (currentWeapon instanceof EnderRifle) { angleMod /= 2; } // Half gravity
turret.rotationPitch -= MathHelper.wrapAngleTo180_double(angleMod);
}
}
示例3: simplifyAngle
import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
/**
* Simplifies the value of a number by adding/subtracting 180 to the point that the number is between -180 and 180.
*/
private float simplifyAngle(double p_70973_1_)
{
return (float)MathHelper.wrapAngleTo180_double(p_70973_1_);
}
示例4: wrapDegrees
import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public static double wrapDegrees(double p_wrapDegrees_0_)
{
return MathHelper.wrapAngleTo180_double(p_wrapDegrees_0_);
}