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 ModelCreeper extends ModelBase
008 {
009 public ModelRenderer head;
010 public ModelRenderer field_78133_b;
011 public ModelRenderer body;
012 public ModelRenderer leg1;
013 public ModelRenderer leg2;
014 public ModelRenderer leg3;
015 public ModelRenderer leg4;
016
017 public ModelCreeper()
018 {
019 this(0.0F);
020 }
021
022 public ModelCreeper(float par1)
023 {
024 byte var2 = 4;
025 this.head = new ModelRenderer(this, 0, 0);
026 this.head.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, par1);
027 this.head.setRotationPoint(0.0F, (float)var2, 0.0F);
028 this.field_78133_b = new ModelRenderer(this, 32, 0);
029 this.field_78133_b.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, par1 + 0.5F);
030 this.field_78133_b.setRotationPoint(0.0F, (float)var2, 0.0F);
031 this.body = new ModelRenderer(this, 16, 16);
032 this.body.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, par1);
033 this.body.setRotationPoint(0.0F, (float)var2, 0.0F);
034 this.leg1 = new ModelRenderer(this, 0, 16);
035 this.leg1.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, par1);
036 this.leg1.setRotationPoint(-2.0F, (float)(12 + var2), 4.0F);
037 this.leg2 = new ModelRenderer(this, 0, 16);
038 this.leg2.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, par1);
039 this.leg2.setRotationPoint(2.0F, (float)(12 + var2), 4.0F);
040 this.leg3 = new ModelRenderer(this, 0, 16);
041 this.leg3.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, par1);
042 this.leg3.setRotationPoint(-2.0F, (float)(12 + var2), -4.0F);
043 this.leg4 = new ModelRenderer(this, 0, 16);
044 this.leg4.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, par1);
045 this.leg4.setRotationPoint(2.0F, (float)(12 + var2), -4.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 this.head.render(par7);
055 this.body.render(par7);
056 this.leg1.render(par7);
057 this.leg2.render(par7);
058 this.leg3.render(par7);
059 this.leg4.render(par7);
060 }
061
062 /**
063 * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
064 * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
065 * "far" arms and legs can swing at most.
066 */
067 public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)
068 {
069 this.head.rotateAngleY = par4 / (180F / (float)Math.PI);
070 this.head.rotateAngleX = par5 / (180F / (float)Math.PI);
071 this.leg1.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2;
072 this.leg2.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2;
073 this.leg3.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2;
074 this.leg4.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2;
075 }
076 }