当前位置: 首页>>代码示例>>Java>>正文


Java MathHelper.wrapAngleTo180_float方法代码示例

本文整理汇总了Java中net.minecraft.util.MathHelper.wrapAngleTo180_float方法的典型用法代码示例。如果您正苦于以下问题:Java MathHelper.wrapAngleTo180_float方法的具体用法?Java MathHelper.wrapAngleTo180_float怎么用?Java MathHelper.wrapAngleTo180_float使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.util.MathHelper的用法示例。


在下文中一共展示了MathHelper.wrapAngleTo180_float方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateRotation

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
/**
 * Arguments: current rotation, intended rotation, max increment.
 */
private float updateRotation(float p_70663_1_, float p_70663_2_, float p_70663_3_)
{
    float f = MathHelper.wrapAngleTo180_float(p_70663_2_ - p_70663_1_);

    if (f > p_70663_3_)
    {
        f = p_70663_3_;
    }

    if (f < -p_70663_3_)
    {
        f = -p_70663_3_;
    }

    return p_70663_1_ + f;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:20,代码来源:EntityLiving.java

示例2: func_82204_b

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
private float func_82204_b(float p_82204_1_, float p_82204_2_, float p_82204_3_)
{
    float f = MathHelper.wrapAngleTo180_float(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;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:17,代码来源:EntityWither.java

示例3: updateRotation

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
private float updateRotation(float p_75652_1_, float p_75652_2_, float p_75652_3_)
{
    float f = MathHelper.wrapAngleTo180_float(p_75652_2_ - p_75652_1_);

    if (f > p_75652_3_)
    {
        f = p_75652_3_;
    }

    if (f < -p_75652_3_)
    {
        f = -p_75652_3_;
    }

    return p_75652_1_ + f;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:17,代码来源:EntityLookHelper.java

示例4: limitAngle

import net.minecraft.util.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.wrapAngleTo180_float(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;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:31,代码来源:EntityMoveHelper.java

示例5: onUpdateLook

import net.minecraft.util.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.func_181159_b(d2, d0) * 180.0D / Math.PI) - 90.0F;
        float f1 = (float)(-(MathHelper.func_181159_b(d1, d3) * 180.0D / 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.wrapAngleTo180_float(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;
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:40,代码来源:EntityLookHelper.java

示例6: func_110146_f

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
protected float func_110146_f(float p_110146_1_, float p_110146_2_)
{
    float f = MathHelper.wrapAngleTo180_float(p_110146_1_ - this.renderYawOffset);
    this.renderYawOffset += f * 0.3F;
    float f1 = MathHelper.wrapAngleTo180_float(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_;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:32,代码来源:EntityLivingBase.java

示例7: updateAITasks

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
protected void updateAITasks()
{
    super.updateAITasks();
    BlockPos blockpos = new BlockPos(this);
    BlockPos blockpos1 = blockpos.up();

    if (this.getIsBatHanging())
    {
        if (!this.worldObj.getBlockState(blockpos1).getBlock().isNormalCube())
        {
            this.setIsBatHanging(false);
            this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1015, blockpos, 0);
        }
        else
        {
            if (this.rand.nextInt(200) == 0)
            {
                this.rotationYawHead = (float)this.rand.nextInt(360);
            }

            if (this.worldObj.getClosestPlayerToEntity(this, 4.0D) != null)
            {
                this.setIsBatHanging(false);
                this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1015, blockpos, 0);
            }
        }
    }
    else
    {
        if (this.spawnPosition != null && (!this.worldObj.isAirBlock(this.spawnPosition) || this.spawnPosition.getY() < 1))
        {
            this.spawnPosition = null;
        }

        if (this.spawnPosition == null || this.rand.nextInt(30) == 0 || this.spawnPosition.distanceSq((double)((int)this.posX), (double)((int)this.posY), (double)((int)this.posZ)) < 4.0D)
        {
            this.spawnPosition = new BlockPos((int)this.posX + this.rand.nextInt(7) - this.rand.nextInt(7), (int)this.posY + this.rand.nextInt(6) - 2, (int)this.posZ + this.rand.nextInt(7) - this.rand.nextInt(7));
        }

        double d0 = (double)this.spawnPosition.getX() + 0.5D - this.posX;
        double d1 = (double)this.spawnPosition.getY() + 0.1D - this.posY;
        double d2 = (double)this.spawnPosition.getZ() + 0.5D - this.posZ;
        this.motionX += (Math.signum(d0) * 0.5D - this.motionX) * 0.10000000149011612D;
        this.motionY += (Math.signum(d1) * 0.699999988079071D - this.motionY) * 0.10000000149011612D;
        this.motionZ += (Math.signum(d2) * 0.5D - this.motionZ) * 0.10000000149011612D;
        float f = (float)(MathHelper.func_181159_b(this.motionZ, this.motionX) * 180.0D / Math.PI) - 90.0F;
        float f1 = MathHelper.wrapAngleTo180_float(f - this.rotationYaw);
        this.moveForward = 0.5F;
        this.rotationYaw += f1;

        if (this.rand.nextInt(100) == 0 && this.worldObj.getBlockState(blockpos1).getBlock().isNormalCube())
        {
            this.setIsBatHanging(true);
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:57,代码来源:EntityBat.java

示例8: wrapDegrees

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public static float wrapDegrees(float p_wrapDegrees_0_)
{
    return MathHelper.wrapAngleTo180_float(p_wrapDegrees_0_);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:5,代码来源:RealmsMth.java


注:本文中的net.minecraft.util.MathHelper.wrapAngleTo180_float方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。