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