001 package net.minecraft.src;
002
003 import cpw.mods.fml.common.Side;
004 import cpw.mods.fml.common.asm.SideOnly;
005
006 @SideOnly(Side.CLIENT)
007 public class ModelEnderman extends ModelBiped
008 {
009 /** Is the enderman carrying a block? */
010 public boolean isCarrying = false;
011
012 /** Is the enderman attacking an entity? */
013 public boolean isAttacking = false;
014
015 public ModelEnderman()
016 {
017 super(0.0F, -14.0F);
018 float var1 = -14.0F;
019 float var2 = 0.0F;
020 this.bipedHeadwear = new ModelRenderer(this, 0, 16);
021 this.bipedHeadwear.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, var2 - 0.5F);
022 this.bipedHeadwear.setRotationPoint(0.0F, 0.0F + var1, 0.0F);
023 this.bipedBody = new ModelRenderer(this, 32, 16);
024 this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, var2);
025 this.bipedBody.setRotationPoint(0.0F, 0.0F + var1, 0.0F);
026 this.bipedRightArm = new ModelRenderer(this, 56, 0);
027 this.bipedRightArm.addBox(-1.0F, -2.0F, -1.0F, 2, 30, 2, var2);
028 this.bipedRightArm.setRotationPoint(-3.0F, 2.0F + var1, 0.0F);
029 this.bipedLeftArm = new ModelRenderer(this, 56, 0);
030 this.bipedLeftArm.mirror = true;
031 this.bipedLeftArm.addBox(-1.0F, -2.0F, -1.0F, 2, 30, 2, var2);
032 this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + var1, 0.0F);
033 this.bipedRightLeg = new ModelRenderer(this, 56, 0);
034 this.bipedRightLeg.addBox(-1.0F, 0.0F, -1.0F, 2, 30, 2, var2);
035 this.bipedRightLeg.setRotationPoint(-2.0F, 12.0F + var1, 0.0F);
036 this.bipedLeftLeg = new ModelRenderer(this, 56, 0);
037 this.bipedLeftLeg.mirror = true;
038 this.bipedLeftLeg.addBox(-1.0F, 0.0F, -1.0F, 2, 30, 2, var2);
039 this.bipedLeftLeg.setRotationPoint(2.0F, 12.0F + var1, 0.0F);
040 }
041
042 /**
043 * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
044 * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
045 * "far" arms and legs can swing at most.
046 */
047 public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6)
048 {
049 super.setRotationAngles(par1, par2, par3, par4, par5, par6);
050 this.bipedHead.showModel = true;
051 float var7 = -14.0F;
052 this.bipedBody.rotateAngleX = 0.0F;
053 this.bipedBody.rotationPointY = var7;
054 this.bipedBody.rotationPointZ = -0.0F;
055 this.bipedRightLeg.rotateAngleX -= 0.0F;
056 this.bipedLeftLeg.rotateAngleX -= 0.0F;
057 this.bipedRightArm.rotateAngleX = (float)((double)this.bipedRightArm.rotateAngleX * 0.5D);
058 this.bipedLeftArm.rotateAngleX = (float)((double)this.bipedLeftArm.rotateAngleX * 0.5D);
059 this.bipedRightLeg.rotateAngleX = (float)((double)this.bipedRightLeg.rotateAngleX * 0.5D);
060 this.bipedLeftLeg.rotateAngleX = (float)((double)this.bipedLeftLeg.rotateAngleX * 0.5D);
061 float var8 = 0.4F;
062
063 if (this.bipedRightArm.rotateAngleX > var8)
064 {
065 this.bipedRightArm.rotateAngleX = var8;
066 }
067
068 if (this.bipedLeftArm.rotateAngleX > var8)
069 {
070 this.bipedLeftArm.rotateAngleX = var8;
071 }
072
073 if (this.bipedRightArm.rotateAngleX < -var8)
074 {
075 this.bipedRightArm.rotateAngleX = -var8;
076 }
077
078 if (this.bipedLeftArm.rotateAngleX < -var8)
079 {
080 this.bipedLeftArm.rotateAngleX = -var8;
081 }
082
083 if (this.bipedRightLeg.rotateAngleX > var8)
084 {
085 this.bipedRightLeg.rotateAngleX = var8;
086 }
087
088 if (this.bipedLeftLeg.rotateAngleX > var8)
089 {
090 this.bipedLeftLeg.rotateAngleX = var8;
091 }
092
093 if (this.bipedRightLeg.rotateAngleX < -var8)
094 {
095 this.bipedRightLeg.rotateAngleX = -var8;
096 }
097
098 if (this.bipedLeftLeg.rotateAngleX < -var8)
099 {
100 this.bipedLeftLeg.rotateAngleX = -var8;
101 }
102
103 if (this.isCarrying)
104 {
105 this.bipedRightArm.rotateAngleX = -0.5F;
106 this.bipedLeftArm.rotateAngleX = -0.5F;
107 this.bipedRightArm.rotateAngleZ = 0.05F;
108 this.bipedLeftArm.rotateAngleZ = -0.05F;
109 }
110
111 this.bipedRightArm.rotationPointZ = 0.0F;
112 this.bipedLeftArm.rotationPointZ = 0.0F;
113 this.bipedRightLeg.rotationPointZ = 0.0F;
114 this.bipedLeftLeg.rotationPointZ = 0.0F;
115 this.bipedRightLeg.rotationPointY = 9.0F + var7;
116 this.bipedLeftLeg.rotationPointY = 9.0F + var7;
117 this.bipedHead.rotationPointZ = -0.0F;
118 this.bipedHead.rotationPointY = var7 + 1.0F;
119 this.bipedHeadwear.rotationPointX = this.bipedHead.rotationPointX;
120 this.bipedHeadwear.rotationPointY = this.bipedHead.rotationPointY;
121 this.bipedHeadwear.rotationPointZ = this.bipedHead.rotationPointZ;
122 this.bipedHeadwear.rotateAngleX = this.bipedHead.rotateAngleX;
123 this.bipedHeadwear.rotateAngleY = this.bipedHead.rotateAngleY;
124 this.bipedHeadwear.rotateAngleZ = this.bipedHead.rotateAngleZ;
125
126 if (this.isAttacking)
127 {
128 float var9 = 1.0F;
129 this.bipedHead.rotationPointY -= var9 * 5.0F;
130 }
131 }
132 }