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 ModelSnowMan extends ModelBase
008    {
009        public ModelRenderer body;
010        public ModelRenderer bottomBody;
011        public ModelRenderer head;
012        public ModelRenderer rightHand;
013        public ModelRenderer leftHand;
014    
015        public ModelSnowMan()
016        {
017            float var1 = 4.0F;
018            float var2 = 0.0F;
019            this.head = (new ModelRenderer(this, 0, 0)).setTextureSize(64, 64);
020            this.head.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, var2 - 0.5F);
021            this.head.setRotationPoint(0.0F, 0.0F + var1, 0.0F);
022            this.rightHand = (new ModelRenderer(this, 32, 0)).setTextureSize(64, 64);
023            this.rightHand.addBox(-1.0F, 0.0F, -1.0F, 12, 2, 2, var2 - 0.5F);
024            this.rightHand.setRotationPoint(0.0F, 0.0F + var1 + 9.0F - 7.0F, 0.0F);
025            this.leftHand = (new ModelRenderer(this, 32, 0)).setTextureSize(64, 64);
026            this.leftHand.addBox(-1.0F, 0.0F, -1.0F, 12, 2, 2, var2 - 0.5F);
027            this.leftHand.setRotationPoint(0.0F, 0.0F + var1 + 9.0F - 7.0F, 0.0F);
028            this.body = (new ModelRenderer(this, 0, 16)).setTextureSize(64, 64);
029            this.body.addBox(-5.0F, -10.0F, -5.0F, 10, 10, 10, var2 - 0.5F);
030            this.body.setRotationPoint(0.0F, 0.0F + var1 + 9.0F, 0.0F);
031            this.bottomBody = (new ModelRenderer(this, 0, 36)).setTextureSize(64, 64);
032            this.bottomBody.addBox(-6.0F, -12.0F, -6.0F, 12, 12, 12, var2 - 0.5F);
033            this.bottomBody.setRotationPoint(0.0F, 0.0F + var1 + 20.0F, 0.0F);
034        }
035    
036        /**
037         * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
038         * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
039         * "far" arms and legs can swing at most.
040         */
041        public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6)
042        {
043            super.setRotationAngles(par1, par2, par3, par4, par5, par6);
044            this.head.rotateAngleY = par4 / (180F / (float)Math.PI);
045            this.head.rotateAngleX = par5 / (180F / (float)Math.PI);
046            this.body.rotateAngleY = par4 / (180F / (float)Math.PI) * 0.25F;
047            float var7 = MathHelper.sin(this.body.rotateAngleY);
048            float var8 = MathHelper.cos(this.body.rotateAngleY);
049            this.rightHand.rotateAngleZ = 1.0F;
050            this.leftHand.rotateAngleZ = -1.0F;
051            this.rightHand.rotateAngleY = 0.0F + this.body.rotateAngleY;
052            this.leftHand.rotateAngleY = (float)Math.PI + this.body.rotateAngleY;
053            this.rightHand.rotationPointX = var8 * 5.0F;
054            this.rightHand.rotationPointZ = -var7 * 5.0F;
055            this.leftHand.rotationPointX = -var8 * 5.0F;
056            this.leftHand.rotationPointZ = var7 * 5.0F;
057        }
058    
059        /**
060         * Sets the models various rotation angles then renders the model.
061         */
062        public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
063        {
064            this.setRotationAngles(par2, par3, par4, par5, par6, par7);
065            this.body.render(par7);
066            this.bottomBody.render(par7);
067            this.head.render(par7);
068            this.rightHand.render(par7);
069            this.leftHand.render(par7);
070        }
071    }