    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 ModelWither extends ModelBase
    008    {
    009        private ModelRenderer[] field_82905_a;
    010        private ModelRenderer[] field_82904_b;
    011
    012        public ModelWither()
    013        {
    014            this.textureWidth = 64;
    015            this.textureHeight = 64;
    016            this.field_82905_a = new ModelRenderer[3];
    017            this.field_82905_a[0] = new ModelRenderer(this, 0, 16);
    018            this.field_82905_a[0].addBox(-10.0F, 3.9F, -0.5F, 20, 3, 3);
    019            this.field_82905_a[1] = (new ModelRenderer(this)).setTextureSize(this.textureWidth, this.textureHeight);
    020            this.field_82905_a[1].setRotationPoint(-2.0F, 6.9F, -0.5F);
    021            this.field_82905_a[1].setTextureOffset(0, 22).addBox(0.0F, 0.0F, 0.0F, 3, 10, 3);
    022            this.field_82905_a[1].setTextureOffset(24, 22).addBox(-4.0F, 1.5F, 0.5F, 11, 2, 2);
    023            this.field_82905_a[1].setTextureOffset(24, 22).addBox(-4.0F, 4.0F, 0.5F, 11, 2, 2);
    024            this.field_82905_a[1].setTextureOffset(24, 22).addBox(-4.0F, 6.5F, 0.5F, 11, 2, 2);
    025            this.field_82905_a[2] = new ModelRenderer(this, 12, 22);
    026            this.field_82905_a[2].addBox(0.0F, 0.0F, 0.0F, 3, 6, 3);
    027            this.field_82904_b = new ModelRenderer[3];
    028            this.field_82904_b[0] = new ModelRenderer(this, 0, 0);
    029            this.field_82904_b[0].addBox(-4.0F, -4.0F, -4.0F, 8, 8, 8);
    030            this.field_82904_b[1] = new ModelRenderer(this, 32, 0);
    031            this.field_82904_b[1].addBox(-4.0F, -4.0F, -4.0F, 6, 6, 6);
    032            this.field_82904_b[1].rotationPointX = -8.0F;
    033            this.field_82904_b[1].rotationPointY = 4.0F;
    034            this.field_82904_b[2] = new ModelRenderer(this, 32, 0);
    035            this.field_82904_b[2].addBox(-4.0F, -4.0F, -4.0F, 6, 6, 6);
    036            this.field_82904_b[2].rotationPointX = 10.0F;
    037            this.field_82904_b[2].rotationPointY = 4.0F;
    038        }
    039
    040        public int func_82903_a()
    041        {
    042            return 32;
    043        }
    044
    045        /**
    046         * Sets the models various rotation angles then renders the model.
    047         */
    048        public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
    049        {
    050            this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
    051            ModelRenderer[] var8 = this.field_82904_b;
    052            int var9 = var8.length;
    053            int var10;
    054            ModelRenderer var11;
    055
    056            for (var10 = 0; var10 < var9; ++var10)
    057            {
    058                var11 = var8[var10];
    059                var11.render(par7);
    060            }
    061
    062            var8 = this.field_82905_a;
    063            var9 = var8.length;
    064
    065            for (var10 = 0; var10 < var9; ++var10)
    066            {
    067                var11 = var8[var10];
    068                var11.render(par7);
    069            }
    070        }
    071
    072        /**
    073         * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
    074         * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
    075         * "far" arms and legs can swing at most.
    076         */
    077        public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)
    078        {
    079            float var8 = MathHelper.cos(par3 * 0.1F);
    080            this.field_82905_a[1].rotateAngleX = (0.065F + 0.05F * var8) * (float)Math.PI;
    081            this.field_82905_a[2].setRotationPoint(-2.0F, 6.9F + MathHelper.cos(this.field_82905_a[1].rotateAngleX) * 10.0F, -0.5F + MathHelper.sin(this.field_82905_a[1].rotateAngleX) * 10.0F);
    082            this.field_82905_a[2].rotateAngleX = (0.265F + 0.1F * var8) * (float)Math.PI;
    083            this.field_82904_b[0].rotateAngleY = par4 / (180F / (float)Math.PI);
    084            this.field_82904_b[0].rotateAngleX = par5 / (180F / (float)Math.PI);
    085        }
    086
    087        /**
    088         * Used for easily adding entity-dependent animations. The second and third float params here are the same second
    089         * and third as in the setRotationAngles method.
    090         */
    091        public void setLivingAnimations(EntityLiving par1EntityLiving, float par2, float par3, float par4)
    092        {
    093            EntityWither var5 = (EntityWither)par1EntityLiving;
    094
    095            for (int var6 = 1; var6 < 3; ++var6)
    096            {
    097                this.field_82904_b[var6].rotateAngleY = (var5.func_82207_a(var6 - 1) - par1EntityLiving.renderYawOffset) / (180F / (float)Math.PI);
    098                this.field_82904_b[var6].rotateAngleX = var5.func_82210_r(var6 - 1) / (180F / (float)Math.PI);
    099            }
    100        }
    101    }