001 package net.minecraft.src;
002
003 import cpw.mods.fml.common.Side;
004 import cpw.mods.fml.common.asm.SideOnly;
005 import org.lwjgl.opengl.GL11;
006
007 @SideOnly(Side.CLIENT)
008 public class ModelChicken extends ModelBase
009 {
010 public ModelRenderer head;
011 public ModelRenderer body;
012 public ModelRenderer rightLeg;
013 public ModelRenderer leftLeg;
014 public ModelRenderer rightWing;
015 public ModelRenderer leftWing;
016 public ModelRenderer bill;
017 public ModelRenderer chin;
018
019 public ModelChicken()
020 {
021 byte var1 = 16;
022 this.head = new ModelRenderer(this, 0, 0);
023 this.head.addBox(-2.0F, -6.0F, -2.0F, 4, 6, 3, 0.0F);
024 this.head.setRotationPoint(0.0F, (float)(-1 + var1), -4.0F);
025 this.bill = new ModelRenderer(this, 14, 0);
026 this.bill.addBox(-2.0F, -4.0F, -4.0F, 4, 2, 2, 0.0F);
027 this.bill.setRotationPoint(0.0F, (float)(-1 + var1), -4.0F);
028 this.chin = new ModelRenderer(this, 14, 4);
029 this.chin.addBox(-1.0F, -2.0F, -3.0F, 2, 2, 2, 0.0F);
030 this.chin.setRotationPoint(0.0F, (float)(-1 + var1), -4.0F);
031 this.body = new ModelRenderer(this, 0, 9);
032 this.body.addBox(-3.0F, -4.0F, -3.0F, 6, 8, 6, 0.0F);
033 this.body.setRotationPoint(0.0F, (float)var1, 0.0F);
034 this.rightLeg = new ModelRenderer(this, 26, 0);
035 this.rightLeg.addBox(-1.0F, 0.0F, -3.0F, 3, 5, 3);
036 this.rightLeg.setRotationPoint(-2.0F, (float)(3 + var1), 1.0F);
037 this.leftLeg = new ModelRenderer(this, 26, 0);
038 this.leftLeg.addBox(-1.0F, 0.0F, -3.0F, 3, 5, 3);
039 this.leftLeg.setRotationPoint(1.0F, (float)(3 + var1), 1.0F);
040 this.rightWing = new ModelRenderer(this, 24, 13);
041 this.rightWing.addBox(0.0F, 0.0F, -3.0F, 1, 4, 6);
042 this.rightWing.setRotationPoint(-4.0F, (float)(-3 + var1), 0.0F);
043 this.leftWing = new ModelRenderer(this, 24, 13);
044 this.leftWing.addBox(-1.0F, 0.0F, -3.0F, 1, 4, 6);
045 this.leftWing.setRotationPoint(4.0F, (float)(-3 + var1), 0.0F);
046 }
047
048 /**
049 * Sets the models various rotation angles then renders the model.
050 */
051 public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
052 {
053 this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
054
055 if (this.isChild)
056 {
057 float var8 = 2.0F;
058 GL11.glPushMatrix();
059 GL11.glTranslatef(0.0F, 5.0F * par7, 2.0F * par7);
060 this.head.render(par7);
061 this.bill.render(par7);
062 this.chin.render(par7);
063 GL11.glPopMatrix();
064 GL11.glPushMatrix();
065 GL11.glScalef(1.0F / var8, 1.0F / var8, 1.0F / var8);
066 GL11.glTranslatef(0.0F, 24.0F * par7, 0.0F);
067 this.body.render(par7);
068 this.rightLeg.render(par7);
069 this.leftLeg.render(par7);
070 this.rightWing.render(par7);
071 this.leftWing.render(par7);
072 GL11.glPopMatrix();
073 }
074 else
075 {
076 this.head.render(par7);
077 this.bill.render(par7);
078 this.chin.render(par7);
079 this.body.render(par7);
080 this.rightLeg.render(par7);
081 this.leftLeg.render(par7);
082 this.rightWing.render(par7);
083 this.leftWing.render(par7);
084 }
085 }
086
087 /**
088 * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
089 * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
090 * "far" arms and legs can swing at most.
091 */
092 public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)
093 {
094 this.head.rotateAngleX = -(par5 / (180F / (float)Math.PI));
095 this.head.rotateAngleY = par4 / (180F / (float)Math.PI);
096 this.bill.rotateAngleX = this.head.rotateAngleX;
097 this.bill.rotateAngleY = this.head.rotateAngleY;
098 this.chin.rotateAngleX = this.head.rotateAngleX;
099 this.chin.rotateAngleY = this.head.rotateAngleY;
100 this.body.rotateAngleX = ((float)Math.PI / 2F);
101 this.rightLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2;
102 this.leftLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2;
103 this.rightWing.rotateAngleZ = par3;
104 this.leftWing.rotateAngleZ = -par3;
105 }
106 }