本文整理汇总了Java中net.minecraft.util.math.MathHelper.wrapDegrees方法的典型用法代码示例。如果您正苦于以下问题:Java MathHelper.wrapDegrees方法的具体用法?Java MathHelper.wrapDegrees怎么用?Java MathHelper.wrapDegrees使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.util.math.MathHelper
的用法示例。
在下文中一共展示了MathHelper.wrapDegrees方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeAngleWithBound
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
/**
* Return the new angle2 such that the difference between angle1 and angle2 is lower than angleMax. Args : angle1,
* angle2, angleMax
*/
private float computeAngleWithBound(float p_75665_1_, float p_75665_2_, float p_75665_3_)
{
float f = MathHelper.wrapDegrees(p_75665_1_ - p_75665_2_);
if (f < -p_75665_3_)
{
f = -p_75665_3_;
}
if (f >= p_75665_3_)
{
f = p_75665_3_;
}
return p_75665_1_ - f;
}
示例2: rotlerp
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
private float rotlerp(float p_82204_1_, float p_82204_2_, float p_82204_3_)
{
float f = MathHelper.wrapDegrees(p_82204_2_ - p_82204_1_);
if (f > p_82204_3_)
{
f = p_82204_3_;
}
if (f < -p_82204_3_)
{
f = -p_82204_3_;
}
return p_82204_1_ + f;
}
示例3: getRotatedYaw
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
/**
* Transforms the entity's current yaw with the given Rotation and returns it. This does not have a side-effect.
*/
public float getRotatedYaw(Rotation transformRotation)
{
float f = MathHelper.wrapDegrees(this.rotationYaw);
switch (transformRotation)
{
case CLOCKWISE_180:
return f + 180.0F;
case COUNTERCLOCKWISE_90:
return f + 270.0F;
case CLOCKWISE_90:
return f + 90.0F;
default:
return f;
}
}
示例4: onUpdateLook
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
/**
* Updates look
*/
public void onUpdateLook()
{
this.entity.rotationPitch = 0.0F;
if (this.isLooking)
{
this.isLooking = false;
double d0 = this.posX - this.entity.posX;
double d1 = this.posY - (this.entity.posY + (double)this.entity.getEyeHeight());
double d2 = this.posZ - this.entity.posZ;
double d3 = (double)MathHelper.sqrt_double(d0 * d0 + d2 * d2);
float f = (float)(MathHelper.atan2(d2, d0) * (180D / Math.PI)) - 90.0F;
float f1 = (float)(-(MathHelper.atan2(d1, d3) * (180D / Math.PI)));
this.entity.rotationPitch = this.updateRotation(this.entity.rotationPitch, f1, this.deltaLookPitch);
this.entity.rotationYawHead = this.updateRotation(this.entity.rotationYawHead, f, this.deltaLookYaw);
}
else
{
this.entity.rotationYawHead = this.updateRotation(this.entity.rotationYawHead, this.entity.renderYawOffset, 10.0F);
}
float f2 = MathHelper.wrapDegrees(this.entity.rotationYawHead - this.entity.renderYawOffset);
if (!this.entity.getNavigator().noPath())
{
if (f2 < -75.0F)
{
this.entity.rotationYawHead = this.entity.renderYawOffset - 75.0F;
}
if (f2 > 75.0F)
{
this.entity.rotationYawHead = this.entity.renderYawOffset + 75.0F;
}
}
}
示例5: getAngleToClientRotation
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
public static float getAngleToClientRotation(IEntity entity) {
float[] needed = getRotations(entity.getEntity().boundingBox.getCenter());
float diffYaw = MathHelper.wrapDegrees(Minecraft.getMinecraft().player.rotationYaw) - needed[0];
float diffPitch = MathHelper.wrapDegrees(Minecraft.getMinecraft().player.rotationPitch) - needed[1];
float angle = MathHelper.sqrt(diffYaw * diffYaw + diffPitch * diffPitch);
return angle;
}
示例6: getMirroredYaw
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
/**
* Transforms the entity's current yaw with the given Mirror and returns it. This does not have a side-effect.
*/
public float getMirroredYaw(Mirror transformMirror)
{
float f = MathHelper.wrapDegrees(this.rotationYaw);
switch (transformMirror)
{
case LEFT_RIGHT:
return -f;
case FRONT_BACK:
return 180.0F - f;
default:
return f;
}
}
示例7: applyYawToEntity
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
/**
* Applies this boat's yaw to the given entity. Used to update the orientation of its passenger.
*/
protected void applyYawToEntity(Entity entityToUpdate)
{
entityToUpdate.setRenderYawOffset(this.rotationYaw);
float f = MathHelper.wrapDegrees(entityToUpdate.rotationYaw - this.rotationYaw);
float f1 = MathHelper.clamp(f, -105.0F, 105.0F);
entityToUpdate.prevRotationYaw += f1 - f;
entityToUpdate.rotationYaw += f1 - f;
entityToUpdate.setRotationYawHead(entityToUpdate.rotationYaw);
}
示例8: limitAngle
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
/**
* Limits the given angle to a upper and lower limit.
*/
protected float limitAngle(float p_75639_1_, float p_75639_2_, float p_75639_3_)
{
float f = MathHelper.wrapDegrees(p_75639_2_ - p_75639_1_);
if (f > p_75639_3_)
{
f = p_75639_3_;
}
if (f < -p_75639_3_)
{
f = -p_75639_3_;
}
float f1 = p_75639_1_ + f;
if (f1 < 0.0F)
{
f1 += 360.0F;
}
else if (f1 > 360.0F)
{
f1 -= 360.0F;
}
return f1;
}
示例9: updateDistance
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
protected float updateDistance(float p_110146_1_, float p_110146_2_)
{
float f = MathHelper.wrapDegrees(p_110146_1_ - this.renderYawOffset);
this.renderYawOffset += f * 0.3F;
float f1 = MathHelper.wrapDegrees(this.rotationYaw - this.renderYawOffset);
boolean flag = f1 < -90.0F || f1 >= 90.0F;
if (f1 < -75.0F)
{
f1 = -75.0F;
}
if (f1 >= 75.0F)
{
f1 = 75.0F;
}
this.renderYawOffset = this.rotationYaw - f1;
if (f1 * f1 > 2500.0F)
{
this.renderYawOffset += f1 * 0.2F;
}
if (flag)
{
p_110146_2_ *= -1.0F;
}
return p_110146_2_;
}
示例10: wrapDegrees
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
public static float wrapDegrees(float value)
{
return MathHelper.wrapDegrees(value);
}
示例11: wrapDegrees
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
public static double wrapDegrees(double value) {
return MathHelper.wrapDegrees(value);
}
示例12: limitAngleChange
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
private static float limitAngleChange(float current, float intended, float maxChange) {
float change = MathHelper.wrapDegrees(intended - current);
change = MathHelper.clamp(change, -maxChange, maxChange);
return MathHelper.wrapDegrees(current + change);
}
示例13: simplifyAngle
import net.minecraft.util.math.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.wrapDegrees(p_70973_1_);
}
示例14: teleportEntityToCoordinates
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
/**
* Teleports an entity to the specified coordinates
*/
private static void teleportEntityToCoordinates(Entity p_189863_0_, CommandBase.CoordinateArg p_189863_1_, CommandBase.CoordinateArg p_189863_2_, CommandBase.CoordinateArg p_189863_3_, CommandBase.CoordinateArg p_189863_4_, CommandBase.CoordinateArg p_189863_5_)
{
if (p_189863_0_ instanceof EntityPlayerMP)
{
Set<SPacketPlayerPosLook.EnumFlags> set = EnumSet.<SPacketPlayerPosLook.EnumFlags>noneOf(SPacketPlayerPosLook.EnumFlags.class);
if (p_189863_1_.isRelative())
{
set.add(SPacketPlayerPosLook.EnumFlags.X);
}
if (p_189863_2_.isRelative())
{
set.add(SPacketPlayerPosLook.EnumFlags.Y);
}
if (p_189863_3_.isRelative())
{
set.add(SPacketPlayerPosLook.EnumFlags.Z);
}
if (p_189863_5_.isRelative())
{
set.add(SPacketPlayerPosLook.EnumFlags.X_ROT);
}
if (p_189863_4_.isRelative())
{
set.add(SPacketPlayerPosLook.EnumFlags.Y_ROT);
}
float f = (float)p_189863_4_.getAmount();
if (!p_189863_4_.isRelative())
{
f = MathHelper.wrapDegrees(f);
}
float f1 = (float)p_189863_5_.getAmount();
if (!p_189863_5_.isRelative())
{
f1 = MathHelper.wrapDegrees(f1);
}
p_189863_0_.dismountRidingEntity();
((EntityPlayerMP)p_189863_0_).connection.setPlayerLocation(p_189863_1_.getAmount(), p_189863_2_.getAmount(), p_189863_3_.getAmount(), f, f1, set);
p_189863_0_.setRotationYawHead(f);
}
else
{
float f2 = (float)MathHelper.wrapDegrees(p_189863_4_.getResult());
float f3 = (float)MathHelper.wrapDegrees(p_189863_5_.getResult());
f3 = MathHelper.clamp(f3, -90.0F, 90.0F);
p_189863_0_.setLocationAndAngles(p_189863_1_.getResult(), p_189863_2_.getResult(), p_189863_3_.getResult(), f2, f3);
p_189863_0_.setRotationYawHead(f2);
}
if (!(p_189863_0_ instanceof EntityLivingBase) || !((EntityLivingBase)p_189863_0_).isElytraFlying())
{
p_189863_0_.motionY = 0.0D;
p_189863_0_.onGround = true;
}
}
示例15: wrapDegrees
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
public static double wrapDegrees(double p_wrapDegrees_0_)
{
return MathHelper.wrapDegrees(p_wrapDegrees_0_);
}