001    package net.minecraft.client.model;
002    
003    import cpw.mods.fml.relauncher.Side;
004    import cpw.mods.fml.relauncher.SideOnly;
005    import net.minecraft.entity.Entity;
006    import net.minecraft.util.MathHelper;
007    
008    @SideOnly(Side.CLIENT)
009    public class ModelCreeper extends ModelBase
010    {
011        public ModelRenderer head;
012        public ModelRenderer field_78133_b;
013        public ModelRenderer body;
014        public ModelRenderer leg1;
015        public ModelRenderer leg2;
016        public ModelRenderer leg3;
017        public ModelRenderer leg4;
018    
019        public ModelCreeper()
020        {
021            this(0.0F);
022        }
023    
024        public ModelCreeper(float par1)
025        {
026            byte var2 = 4;
027            this.head = new ModelRenderer(this, 0, 0);
028            this.head.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, par1);
029            this.head.setRotationPoint(0.0F, (float)var2, 0.0F);
030            this.field_78133_b = new ModelRenderer(this, 32, 0);
031            this.field_78133_b.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, par1 + 0.5F);
032            this.field_78133_b.setRotationPoint(0.0F, (float)var2, 0.0F);
033            this.body = new ModelRenderer(this, 16, 16);
034            this.body.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, par1);
035            this.body.setRotationPoint(0.0F, (float)var2, 0.0F);
036            this.leg1 = new ModelRenderer(this, 0, 16);
037            this.leg1.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, par1);
038            this.leg1.setRotationPoint(-2.0F, (float)(12 + var2), 4.0F);
039            this.leg2 = new ModelRenderer(this, 0, 16);
040            this.leg2.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, par1);
041            this.leg2.setRotationPoint(2.0F, (float)(12 + var2), 4.0F);
042            this.leg3 = new ModelRenderer(this, 0, 16);
043            this.leg3.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, par1);
044            this.leg3.setRotationPoint(-2.0F, (float)(12 + var2), -4.0F);
045            this.leg4 = new ModelRenderer(this, 0, 16);
046            this.leg4.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, par1);
047            this.leg4.setRotationPoint(2.0F, (float)(12 + var2), -4.0F);
048        }
049    
050        /**
051         * Sets the models various rotation angles then renders the model.
052         */
053        public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
054        {
055            this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
056            this.head.render(par7);
057            this.body.render(par7);
058            this.leg1.render(par7);
059            this.leg2.render(par7);
060            this.leg3.render(par7);
061            this.leg4.render(par7);
062        }
063    
064        /**
065         * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
066         * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
067         * "far" arms and legs can swing at most.
068         */
069        public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)
070        {
071            this.head.rotateAngleY = par4 / (180F / (float)Math.PI);
072            this.head.rotateAngleX = par5 / (180F / (float)Math.PI);
073            this.leg1.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2;
074            this.leg2.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2;
075            this.leg3.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2;
076            this.leg4.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2;
077        }
078    }