    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 ModelBat extends ModelBase
    008    {
    009        private ModelRenderer field_82895_a;
    010        private ModelRenderer field_82893_b;
    011        private ModelRenderer field_82894_c;
    012        private ModelRenderer field_82891_d;
    013        private ModelRenderer field_82892_e;
    014        private ModelRenderer field_82890_f;
    015
    016        public ModelBat()
    017        {
    018            this.textureWidth = 64;
    019            this.textureHeight = 64;
    020            this.field_82895_a = new ModelRenderer(this, 0, 0);
    021            this.field_82895_a.addBox(-3.0F, -3.0F, -3.0F, 6, 6, 6);
    022            ModelRenderer var1 = new ModelRenderer(this, 24, 0);
    023            var1.addBox(-4.0F, -6.0F, -2.0F, 3, 4, 1);
    024            this.field_82895_a.addChild(var1);
    025            ModelRenderer var2 = new ModelRenderer(this, 24, 0);
    026            var2.mirror = true;
    027            var2.addBox(1.0F, -6.0F, -2.0F, 3, 4, 1);
    028            this.field_82895_a.addChild(var2);
    029            this.field_82893_b = new ModelRenderer(this, 0, 16);
    030            this.field_82893_b.addBox(-3.0F, 4.0F, -3.0F, 6, 12, 6);
    031            this.field_82893_b.setTextureOffset(0, 34).addBox(-5.0F, 16.0F, 0.0F, 10, 6, 1);
    032            this.field_82894_c = new ModelRenderer(this, 42, 0);
    033            this.field_82894_c.addBox(-12.0F, 1.0F, 1.5F, 10, 16, 1);
    034            this.field_82892_e = new ModelRenderer(this, 24, 16);
    035            this.field_82892_e.setRotationPoint(-12.0F, 1.0F, 1.5F);
    036            this.field_82892_e.addBox(-8.0F, 1.0F, 0.0F, 8, 12, 1);
    037            this.field_82891_d = new ModelRenderer(this, 42, 0);
    038            this.field_82891_d.mirror = true;
    039            this.field_82891_d.addBox(2.0F, 1.0F, 1.5F, 10, 16, 1);
    040            this.field_82890_f = new ModelRenderer(this, 24, 16);
    041            this.field_82890_f.mirror = true;
    042            this.field_82890_f.setRotationPoint(12.0F, 1.0F, 1.5F);
    043            this.field_82890_f.addBox(0.0F, 1.0F, 0.0F, 8, 12, 1);
    044            this.field_82893_b.addChild(this.field_82894_c);
    045            this.field_82893_b.addChild(this.field_82891_d);
    046            this.field_82894_c.addChild(this.field_82892_e);
    047            this.field_82891_d.addChild(this.field_82890_f);
    048        }
    049
    050        public int func_82889_a()
    051        {
    052            return 36;
    053        }
    054
    055        /**
    056         * Sets the models various rotation angles then renders the model.
    057         */
    058        public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
    059        {
    060            EntityBat var8 = (EntityBat)par1Entity;
    061
    062            if (var8.func_82235_h())
    063            {
    064                this.field_82895_a.rotateAngleX = par6 / (180F / (float)Math.PI);
    065                this.field_82895_a.rotateAngleY = (float)Math.PI - par5 / (180F / (float)Math.PI);
    066                this.field_82895_a.rotateAngleZ = (float)Math.PI;
    067                this.field_82895_a.setRotationPoint(0.0F, -2.0F, 0.0F);
    068                this.field_82894_c.setRotationPoint(-3.0F, 0.0F, 3.0F);
    069                this.field_82891_d.setRotationPoint(3.0F, 0.0F, 3.0F);
    070                this.field_82893_b.rotateAngleX = (float)Math.PI;
    071                this.field_82894_c.rotateAngleX = -0.15707964F;
    072                this.field_82894_c.rotateAngleY = -((float)Math.PI * 2F / 5F);
    073                this.field_82892_e.rotateAngleY = -1.7278761F;
    074                this.field_82891_d.rotateAngleX = this.field_82894_c.rotateAngleX;
    075                this.field_82891_d.rotateAngleY = -this.field_82894_c.rotateAngleY;
    076                this.field_82890_f.rotateAngleY = -this.field_82892_e.rotateAngleY;
    077            }
    078            else
    079            {
    080                this.field_82895_a.rotateAngleX = par6 / (180F / (float)Math.PI);
    081                this.field_82895_a.rotateAngleY = par5 / (180F / (float)Math.PI);
    082                this.field_82895_a.rotateAngleZ = 0.0F;
    083                this.field_82895_a.setRotationPoint(0.0F, 0.0F, 0.0F);
    084                this.field_82894_c.setRotationPoint(0.0F, 0.0F, 0.0F);
    085                this.field_82891_d.setRotationPoint(0.0F, 0.0F, 0.0F);
    086                this.field_82893_b.rotateAngleX = ((float)Math.PI / 4F) + MathHelper.cos(par4 * 0.1F) * 0.15F;
    087                this.field_82893_b.rotateAngleY = 0.0F;
    088                this.field_82894_c.rotateAngleY = MathHelper.cos(par4 * 1.3F) * (float)Math.PI * 0.25F;
    089                this.field_82891_d.rotateAngleY = -this.field_82894_c.rotateAngleY;
    090                this.field_82892_e.rotateAngleY = this.field_82894_c.rotateAngleY * 0.5F;
    091                this.field_82890_f.rotateAngleY = -this.field_82894_c.rotateAngleY * 0.5F;
    092            }
    093
    094            this.field_82895_a.render(par7);
    095            this.field_82893_b.render(par7);
    096        }
    097    }