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 ModelBlaze extends ModelBase
008    {
009        /** The sticks that fly around the Blaze. */
010        private ModelRenderer[] blazeSticks = new ModelRenderer[12];
011        private ModelRenderer blazeHead;
012    
013        public ModelBlaze()
014        {
015            for (int var1 = 0; var1 < this.blazeSticks.length; ++var1)
016            {
017                this.blazeSticks[var1] = new ModelRenderer(this, 0, 16);
018                this.blazeSticks[var1].addBox(0.0F, 0.0F, 0.0F, 2, 8, 2);
019            }
020    
021            this.blazeHead = new ModelRenderer(this, 0, 0);
022            this.blazeHead.addBox(-4.0F, -4.0F, -4.0F, 8, 8, 8);
023        }
024    
025        public int func_78104_a()
026        {
027            return 8;
028        }
029    
030        /**
031         * Sets the models various rotation angles then renders the model.
032         */
033        public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
034        {
035            this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
036            this.blazeHead.render(par7);
037    
038            for (int var8 = 0; var8 < this.blazeSticks.length; ++var8)
039            {
040                this.blazeSticks[var8].render(par7);
041            }
042        }
043    
044        /**
045         * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
046         * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
047         * "far" arms and legs can swing at most.
048         */
049        public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)
050        {
051            float var8 = par3 * (float)Math.PI * -0.1F;
052            int var9;
053    
054            for (var9 = 0; var9 < 4; ++var9)
055            {
056                this.blazeSticks[var9].rotationPointY = -2.0F + MathHelper.cos(((float)(var9 * 2) + par3) * 0.25F);
057                this.blazeSticks[var9].rotationPointX = MathHelper.cos(var8) * 9.0F;
058                this.blazeSticks[var9].rotationPointZ = MathHelper.sin(var8) * 9.0F;
059                ++var8;
060            }
061    
062            var8 = ((float)Math.PI / 4F) + par3 * (float)Math.PI * 0.03F;
063    
064            for (var9 = 4; var9 < 8; ++var9)
065            {
066                this.blazeSticks[var9].rotationPointY = 2.0F + MathHelper.cos(((float)(var9 * 2) + par3) * 0.25F);
067                this.blazeSticks[var9].rotationPointX = MathHelper.cos(var8) * 7.0F;
068                this.blazeSticks[var9].rotationPointZ = MathHelper.sin(var8) * 7.0F;
069                ++var8;
070            }
071    
072            var8 = 0.47123894F + par3 * (float)Math.PI * -0.05F;
073    
074            for (var9 = 8; var9 < 12; ++var9)
075            {
076                this.blazeSticks[var9].rotationPointY = 11.0F + MathHelper.cos(((float)var9 * 1.5F + par3) * 0.5F);
077                this.blazeSticks[var9].rotationPointX = MathHelper.cos(var8) * 5.0F;
078                this.blazeSticks[var9].rotationPointZ = MathHelper.sin(var8) * 5.0F;
079                ++var8;
080            }
081    
082            this.blazeHead.rotateAngleY = par4 / (180F / (float)Math.PI);
083            this.blazeHead.rotateAngleX = par5 / (180F / (float)Math.PI);
084        }
085    }