Java Code Examples for net.minecraft.util.MathHelper.cos()

The following are Jave code examples for showing how to use cos() of the net.minecraft.util.MathHelper class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: BaseClient   File: ModelSnowMan.java   View Source Code Vote up 6 votes
/**
 * 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;
}
 
Example 2
Project: BaseClient   File: WorldProvider.java   View Source Code Vote up 6 votes
/**
 * 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;
    }
}
 
Example 3
Project: BaseClient   File: ModelWitch.java   View Source Code Vote up 6 votes
/**
 * 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;
    }
}
 
Example 4
Project: DecompiledMinecraft   File: Item.java   View Source Code Vote up 6 votes
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);
}
 
Example 5
Project: BaseClient   File: EntityFishHook.java   View Source Code Vote up 6 votes
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);
}
 
Example 6
Project: DecompiledMinecraft   File: ActiveRenderInfo.java   View Source Code Vote up 6 votes
/**
 * 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);
}
 
Example 7
Project: DecompiledMinecraft   File: ItemRenderer.java   View Source Code Vote up 5 votes
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;
}
 
Example 8
Project: BaseClient   File: ModelQuadruped.java   View Source Code Vote up 5 votes
/**
 * 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_;
}
 
Example 9
Project: BaseClient   File: EntityWither.java   View Source Code Vote up 5 votes
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;
    }
}
 
Example 10
Project: BaseClient   File: EntityChicken.java   View Source Code Vote up 5 votes
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;
    }
}
 
Example 11
Project: DecompiledMinecraft   File: World.java   View Source Code Vote up 5 votes
/**
 * 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);
}
 
Example 12
Project: BaseClient   File: ModelQuadruped.java   View Source Code Vote up 5 votes
/**
 * 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_;
}
 
Example 13
Project: DecompiledMinecraft   File: ModelVillager.java   View Source Code Vote up 5 votes
/**
 * 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;
}
 
Example 14
Project: DecompiledMinecraft   File: EntityWither.java   View Source Code Vote up 5 votes
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;
    }
}
 
Example 15
Project: minecraft-quiverbow   File: Helper.java   View Source Code Vote up 5 votes
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
}
 
Example 16
Project: DecompiledMinecraft   File: ModelChicken.java   View Source Code Vote up 5 votes
/**
 * 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_;
}
 
Example 17
Project: DecompiledMinecraft   File: WorldProvider.java   View Source Code Vote up 5 votes
/**
 * 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);
}
 
Example 18
Project: DecompiledMinecraft   File: ModelSpider.java   View Source Code Vote up 4 votes
/**
 * 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.spiderHead.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI);
    this.spiderHead.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI);
    float f = ((float)Math.PI / 4F);
    this.spiderLeg1.rotateAngleZ = -f;
    this.spiderLeg2.rotateAngleZ = f;
    this.spiderLeg3.rotateAngleZ = -f * 0.74F;
    this.spiderLeg4.rotateAngleZ = f * 0.74F;
    this.spiderLeg5.rotateAngleZ = -f * 0.74F;
    this.spiderLeg6.rotateAngleZ = f * 0.74F;
    this.spiderLeg7.rotateAngleZ = -f;
    this.spiderLeg8.rotateAngleZ = f;
    float f1 = -0.0F;
    float f2 = 0.3926991F;
    this.spiderLeg1.rotateAngleY = f2 * 2.0F + f1;
    this.spiderLeg2.rotateAngleY = -f2 * 2.0F - f1;
    this.spiderLeg3.rotateAngleY = f2 * 1.0F + f1;
    this.spiderLeg4.rotateAngleY = -f2 * 1.0F - f1;
    this.spiderLeg5.rotateAngleY = -f2 * 1.0F + f1;
    this.spiderLeg6.rotateAngleY = f2 * 1.0F - f1;
    this.spiderLeg7.rotateAngleY = -f2 * 2.0F + f1;
    this.spiderLeg8.rotateAngleY = f2 * 2.0F - f1;
    float f3 = -(MathHelper.cos(p_78087_1_ * 0.6662F * 2.0F + 0.0F) * 0.4F) * p_78087_2_;
    float f4 = -(MathHelper.cos(p_78087_1_ * 0.6662F * 2.0F + (float)Math.PI) * 0.4F) * p_78087_2_;
    float f5 = -(MathHelper.cos(p_78087_1_ * 0.6662F * 2.0F + ((float)Math.PI / 2F)) * 0.4F) * p_78087_2_;
    float f6 = -(MathHelper.cos(p_78087_1_ * 0.6662F * 2.0F + ((float)Math.PI * 3F / 2F)) * 0.4F) * p_78087_2_;
    float f7 = Math.abs(MathHelper.sin(p_78087_1_ * 0.6662F + 0.0F) * 0.4F) * p_78087_2_;
    float f8 = Math.abs(MathHelper.sin(p_78087_1_ * 0.6662F + (float)Math.PI) * 0.4F) * p_78087_2_;
    float f9 = Math.abs(MathHelper.sin(p_78087_1_ * 0.6662F + ((float)Math.PI / 2F)) * 0.4F) * p_78087_2_;
    float f10 = Math.abs(MathHelper.sin(p_78087_1_ * 0.6662F + ((float)Math.PI * 3F / 2F)) * 0.4F) * p_78087_2_;
    this.spiderLeg1.rotateAngleY += f3;
    this.spiderLeg2.rotateAngleY += -f3;
    this.spiderLeg3.rotateAngleY += f4;
    this.spiderLeg4.rotateAngleY += -f4;
    this.spiderLeg5.rotateAngleY += f5;
    this.spiderLeg6.rotateAngleY += -f5;
    this.spiderLeg7.rotateAngleY += f6;
    this.spiderLeg8.rotateAngleY += -f6;
    this.spiderLeg1.rotateAngleZ += f7;
    this.spiderLeg2.rotateAngleZ += -f7;
    this.spiderLeg3.rotateAngleZ += f8;
    this.spiderLeg4.rotateAngleZ += -f8;
    this.spiderLeg5.rotateAngleZ += f9;
    this.spiderLeg6.rotateAngleZ += -f9;
    this.spiderLeg7.rotateAngleZ += f10;
    this.spiderLeg8.rotateAngleZ += -f10;
}
 
Example 19
Project: BaseClient   File: TileEntityBannerRenderer.java   View Source Code Vote up 4 votes
public void renderTileEntityAt(TileEntityBanner te, double x, double y, double z, float partialTicks, int destroyStage)
{
    boolean flag = te.getWorld() != null;
    boolean flag1 = !flag || te.getBlockType() == Blocks.standing_banner;
    int i = flag ? te.getBlockMetadata() : 0;
    long j = flag ? te.getWorld().getTotalWorldTime() : 0L;
    GlStateManager.pushMatrix();
    float f = 0.6666667F;

    if (flag1)
    {
        GlStateManager.translate((float)x + 0.5F, (float)y + 0.75F * f, (float)z + 0.5F);
        float f1 = (float)(i * 360) / 16.0F;
        GlStateManager.rotate(-f1, 0.0F, 1.0F, 0.0F);
        this.bannerModel.bannerStand.showModel = true;
    }
    else
    {
        float f2 = 0.0F;

        if (i == 2)
        {
            f2 = 180.0F;
        }

        if (i == 4)
        {
            f2 = 90.0F;
        }

        if (i == 5)
        {
            f2 = -90.0F;
        }

        GlStateManager.translate((float)x + 0.5F, (float)y - 0.25F * f, (float)z + 0.5F);
        GlStateManager.rotate(-f2, 0.0F, 1.0F, 0.0F);
        GlStateManager.translate(0.0F, -0.3125F, -0.4375F);
        this.bannerModel.bannerStand.showModel = false;
    }

    BlockPos blockpos = te.getPos();
    float f3 = (float)(blockpos.getX() * 7 + blockpos.getY() * 9 + blockpos.getZ() * 13) + (float)j + partialTicks;
    this.bannerModel.bannerSlate.rotateAngleX = (-0.0125F + 0.01F * MathHelper.cos(f3 * (float)Math.PI * 0.02F)) * (float)Math.PI;
    GlStateManager.enableRescaleNormal();
    ResourceLocation resourcelocation = this.func_178463_a(te);

    if (resourcelocation != null)
    {
        this.bindTexture(resourcelocation);
        GlStateManager.pushMatrix();
        GlStateManager.scale(f, -f, -f);
        this.bannerModel.renderBanner();
        GlStateManager.popMatrix();
    }

    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    GlStateManager.popMatrix();
}
 
Example 20
Project: BaseClient   File: EntitySlime.java   View Source Code Vote up 4 votes
/**
 * Called to update the entity's position/logic.
 */
public void onUpdate()
{
    if (!this.worldObj.isRemote && this.worldObj.getDifficulty() == EnumDifficulty.PEACEFUL && this.getSlimeSize() > 0)
    {
        this.isDead = true;
    }

    this.squishFactor += (this.squishAmount - this.squishFactor) * 0.5F;
    this.prevSquishFactor = this.squishFactor;
    super.onUpdate();

    if (this.onGround && !this.wasOnGround)
    {
        int i = this.getSlimeSize();

        for (int j = 0; j < i * 8; ++j)
        {
            float f = this.rand.nextFloat() * (float)Math.PI * 2.0F;
            float f1 = this.rand.nextFloat() * 0.5F + 0.5F;
            float f2 = MathHelper.sin(f) * (float)i * 0.5F * f1;
            float f3 = MathHelper.cos(f) * (float)i * 0.5F * f1;
            World world = this.worldObj;
            EnumParticleTypes enumparticletypes = this.getParticleType();
            double d0 = this.posX + (double)f2;
            double d1 = this.posZ + (double)f3;
            world.spawnParticle(enumparticletypes, d0, this.getEntityBoundingBox().minY, d1, 0.0D, 0.0D, 0.0D, new int[0]);
        }

        if (this.makesSoundOnLand())
        {
            this.playSound(this.getJumpSound(), this.getSoundVolume(), ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) / 0.8F);
        }

        this.squishAmount = -0.5F;
    }
    else if (!this.onGround && this.wasOnGround)
    {
        this.squishAmount = 1.0F;
    }

    this.wasOnGround = this.onGround;
    this.alterSquishAmount();
}