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


Java MathHelper.cos方法代码示例

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


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

示例1: setRotationAngles

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
/**
 * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
 * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
 * "far" arms and legs can swing at most.
 */
public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn)
{
    super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entityIn);
    this.head.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI);
    this.head.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI);
    this.body.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI) * 0.25F;
    float f = MathHelper.sin(this.body.rotateAngleY);
    float f1 = MathHelper.cos(this.body.rotateAngleY);
    this.rightHand.rotateAngleZ = 1.0F;
    this.leftHand.rotateAngleZ = -1.0F;
    this.rightHand.rotateAngleY = 0.0F + this.body.rotateAngleY;
    this.leftHand.rotateAngleY = (float)Math.PI + this.body.rotateAngleY;
    this.rightHand.rotationPointX = f1 * 5.0F;
    this.rightHand.rotationPointZ = -f * 5.0F;
    this.leftHand.rotationPointX = -f1 * 5.0F;
    this.leftHand.rotationPointZ = f * 5.0F;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:23,代码来源:ModelSnowMan.java

示例2: calcSunriseSunsetColors

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
/**
 * Returns array with sunrise/sunset colors
 */
public float[] calcSunriseSunsetColors(float celestialAngle, float partialTicks)
{
    float f = 0.4F;
    float f1 = MathHelper.cos(celestialAngle * (float)Math.PI * 2.0F) - 0.0F;
    float f2 = -0.0F;

    if (f1 >= f2 - f && f1 <= f2 + f)
    {
        float f3 = (f1 - f2) / f * 0.5F + 0.5F;
        float f4 = 1.0F - (1.0F - MathHelper.sin(f3 * (float)Math.PI)) * 0.99F;
        f4 = f4 * f4;
        this.colorsSunriseSunset[0] = f3 * 0.3F + 0.7F;
        this.colorsSunriseSunset[1] = f3 * f3 * 0.7F + 0.2F;
        this.colorsSunriseSunset[2] = f3 * f3 * 0.0F + 0.2F;
        this.colorsSunriseSunset[3] = f4;
        return this.colorsSunriseSunset;
    }
    else
    {
        return null;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:26,代码来源:WorldProvider.java

示例3: setRotationAngles

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
/**
 * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
 * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
 * "far" arms and legs can swing at most.
 */
public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn)
{
    super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entityIn);
    this.villagerNose.offsetX = this.villagerNose.offsetY = this.villagerNose.offsetZ = 0.0F;
    float f = 0.01F * (float)(entityIn.getEntityId() % 10);
    this.villagerNose.rotateAngleX = MathHelper.sin((float)entityIn.ticksExisted * f) * 4.5F * (float)Math.PI / 180.0F;
    this.villagerNose.rotateAngleY = 0.0F;
    this.villagerNose.rotateAngleZ = MathHelper.cos((float)entityIn.ticksExisted * f) * 2.5F * (float)Math.PI / 180.0F;

    if (this.field_82900_g)
    {
        this.villagerNose.rotateAngleX = -0.9F;
        this.villagerNose.offsetZ = -0.09375F;
        this.villagerNose.offsetY = 0.1875F;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:22,代码来源:ModelWitch.java

示例4: getMovingObjectPositionFromPlayer

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
protected MovingObjectPosition getMovingObjectPositionFromPlayer(World worldIn, EntityPlayer playerIn, boolean useLiquids)
{
    float f = playerIn.rotationPitch;
    float f1 = playerIn.rotationYaw;
    double d0 = playerIn.posX;
    double d1 = playerIn.posY + (double)playerIn.getEyeHeight();
    double d2 = playerIn.posZ;
    Vec3 vec3 = new Vec3(d0, d1, d2);
    float f2 = MathHelper.cos(-f1 * 0.017453292F - (float)Math.PI);
    float f3 = MathHelper.sin(-f1 * 0.017453292F - (float)Math.PI);
    float f4 = -MathHelper.cos(-f * 0.017453292F);
    float f5 = MathHelper.sin(-f * 0.017453292F);
    float f6 = f3 * f4;
    float f7 = f2 * f4;
    double d3 = 5.0D;
    Vec3 vec31 = vec3.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3);
    return worldIn.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:19,代码来源:Item.java

示例5: EntityFishHook

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public EntityFishHook(World worldIn, EntityPlayer fishingPlayer)
{
    super(worldIn);
    this.xTile = -1;
    this.yTile = -1;
    this.zTile = -1;
    this.ignoreFrustumCheck = true;
    this.angler = fishingPlayer;
    this.angler.fishEntity = this;
    this.setSize(0.25F, 0.25F);
    this.setLocationAndAngles(fishingPlayer.posX, fishingPlayer.posY + (double)fishingPlayer.getEyeHeight(), fishingPlayer.posZ, fishingPlayer.rotationYaw, fishingPlayer.rotationPitch);
    this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F);
    this.posY -= 0.10000000149011612D;
    this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F);
    this.setPosition(this.posX, this.posY, this.posZ);
    float f = 0.4F;
    this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f);
    this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f);
    this.motionY = (double)(-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI) * f);
    this.handleHookCasting(this.motionX, this.motionY, this.motionZ, 1.5F, 1.0F);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:22,代码来源:EntityFishHook.java

示例6: updateRenderInfo

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
/**
 * Updates the current render info and camera location based on entity look angles and 1st/3rd person view mode
 */
public static void updateRenderInfo(EntityPlayer entityplayerIn, boolean p_74583_1_)
{
    GlStateManager.getFloat(2982, MODELVIEW);
    GlStateManager.getFloat(2983, PROJECTION);
    GL11.glGetInteger(GL11.GL_VIEWPORT, VIEWPORT);
    float f = (float)((VIEWPORT.get(0) + VIEWPORT.get(2)) / 2);
    float f1 = (float)((VIEWPORT.get(1) + VIEWPORT.get(3)) / 2);
    GLU.gluUnProject(f, f1, 0.0F, MODELVIEW, PROJECTION, VIEWPORT, OBJECTCOORDS);
    position = new Vec3((double)OBJECTCOORDS.get(0), (double)OBJECTCOORDS.get(1), (double)OBJECTCOORDS.get(2));
    int i = p_74583_1_ ? 1 : 0;
    float f2 = entityplayerIn.rotationPitch;
    float f3 = entityplayerIn.rotationYaw;
    rotationX = MathHelper.cos(f3 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
    rotationZ = MathHelper.sin(f3 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
    rotationYZ = -rotationZ * MathHelper.sin(f2 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
    rotationXY = rotationX * MathHelper.sin(f2 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
    rotationXZ = MathHelper.cos(f2 * (float)Math.PI / 180.0F);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:22,代码来源:ActiveRenderInfo.java

示例7: func_178100_c

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
private float func_178100_c(float p_178100_1_)
{
    float f = 1.0F - p_178100_1_ / 45.0F + 0.1F;
    f = MathHelper.clamp_float(f, 0.0F, 1.0F);
    f = -MathHelper.cos(f * (float)Math.PI) * 0.5F + 0.5F;
    return f;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:8,代码来源:ItemRenderer.java

示例8: setRotationAngles

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
/**
 * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
 * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
 * "far" arms and legs can swing at most.
 */
public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn)
{
    float f = (180F / (float)Math.PI);
    this.head.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI);
    this.head.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI);
    this.body.rotateAngleX = ((float)Math.PI / 2F);
    this.leg1.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.4F * p_78087_2_;
    this.leg2.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 1.4F * p_78087_2_;
    this.leg3.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 1.4F * p_78087_2_;
    this.leg4.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.4F * p_78087_2_;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:17,代码来源:ModelQuadruped.java

示例9: func_82214_u

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
private double func_82214_u(int p_82214_1_)
{
    if (p_82214_1_ <= 0)
    {
        return this.posX;
    }
    else
    {
        float f = (this.renderYawOffset + (float)(180 * (p_82214_1_ - 1))) / 180.0F * (float)Math.PI;
        float f1 = MathHelper.cos(f);
        return this.posX + (double)f1 * 1.3D;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:14,代码来源:EntityWither.java

示例10: updateRiderPosition

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public void updateRiderPosition()
{
    super.updateRiderPosition();
    float f = MathHelper.sin(this.renderYawOffset * (float)Math.PI / 180.0F);
    float f1 = MathHelper.cos(this.renderYawOffset * (float)Math.PI / 180.0F);
    float f2 = 0.1F;
    float f3 = 0.0F;
    this.riddenByEntity.setPosition(this.posX + (double)(f2 * f), this.posY + (double)(this.height * 0.5F) + this.riddenByEntity.getYOffset() + (double)f3, this.posZ - (double)(f2 * f1));

    if (this.riddenByEntity instanceof EntityLivingBase)
    {
        ((EntityLivingBase)this.riddenByEntity).renderYawOffset = this.renderYawOffset;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:15,代码来源:EntityChicken.java

示例11: calculateSkylightSubtracted

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
/**
 * Returns the amount of skylight subtracted for the current time
 */
public int calculateSkylightSubtracted(float p_72967_1_)
{
    float f = this.getCelestialAngle(p_72967_1_);
    float f1 = 1.0F - (MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F);
    f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F);
    f1 = 1.0F - f1;
    f1 = (float)((double)f1 * (1.0D - (double)(this.getRainStrength(p_72967_1_) * 5.0F) / 16.0D));
    f1 = (float)((double)f1 * (1.0D - (double)(this.getThunderStrength(p_72967_1_) * 5.0F) / 16.0D));
    f1 = 1.0F - f1;
    return (int)(f1 * 11.0F);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:15,代码来源:World.java

示例12: setRotationAngles

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
/**
 * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
 * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
 * "far" arms and legs can swing at most.
 */
public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn)
{
    this.villagerHead.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI);
    this.villagerHead.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI);
    this.villagerArms.rotationPointY = 3.0F;
    this.villagerArms.rotationPointZ = -1.0F;
    this.villagerArms.rotateAngleX = -0.75F;
    this.rightVillagerLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.4F * p_78087_2_ * 0.5F;
    this.leftVillagerLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 1.4F * p_78087_2_ * 0.5F;
    this.rightVillagerLeg.rotateAngleY = 0.0F;
    this.leftVillagerLeg.rotateAngleY = 0.0F;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:18,代码来源:ModelVillager.java

示例13: knockUserBack

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public static void knockUserBack(Entity user, byte strength)
{
	user.motionZ += -MathHelper.cos((user.rotationYaw) * (float)Math.PI / 180.0F) * (strength * 0.08F);
	user.motionX += MathHelper.sin((user.rotationYaw) * (float)Math.PI / 180.0F) * (strength * 0.08F);
	
	NetHelper.sendKickbackMessage(user, strength);	// Informing the client about this
}
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:8,代码来源:Helper.java

示例14: setRotationAngles

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
/**
 * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
 * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
 * "far" arms and legs can swing at most.
 */
public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn)
{
    this.head.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI);
    this.head.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI);
    this.bill.rotateAngleX = this.head.rotateAngleX;
    this.bill.rotateAngleY = this.head.rotateAngleY;
    this.chin.rotateAngleX = this.head.rotateAngleX;
    this.chin.rotateAngleY = this.head.rotateAngleY;
    this.body.rotateAngleX = ((float)Math.PI / 2F);
    this.rightLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.4F * p_78087_2_;
    this.leftLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 1.4F * p_78087_2_;
    this.rightWing.rotateAngleZ = p_78087_3_;
    this.leftWing.rotateAngleZ = -p_78087_3_;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:20,代码来源:ModelChicken.java

示例15: getFogColor

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
/**
 * Return Vec3D with biome specific fog color
 */
public Vec3 getFogColor(float p_76562_1_, float p_76562_2_)
{
    float f = MathHelper.cos(p_76562_1_ * (float)Math.PI * 2.0F) * 2.0F + 0.5F;
    f = MathHelper.clamp_float(f, 0.0F, 1.0F);
    float f1 = 0.7529412F;
    float f2 = 0.84705883F;
    float f3 = 1.0F;
    f1 = f1 * (f * 0.94F + 0.06F);
    f2 = f2 * (f * 0.94F + 0.06F);
    f3 = f3 * (f * 0.91F + 0.09F);
    return new Vec3((double)f1, (double)f2, (double)f3);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:16,代码来源:WorldProvider.java


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