當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。