    001    package net.minecraft.src;
    002
    003    import cpw.mods.fml.common.Side;
    004    import cpw.mods.fml.common.asm.SideOnly;
    005    import org.lwjgl.opengl.GL11;
    006
    007    @SideOnly(Side.CLIENT)
    008    public class RenderBat extends RenderLiving
    009    {
    010        private int field_82446_a;
    011
    012        public RenderBat()
    013        {
    014            super(new ModelBat(), 0.25F);
    015            this.field_82446_a = ((ModelBat)this.mainModel).func_82889_a();
    016        }
    017
    018        public void func_82443_a(EntityBat par1EntityBat, double par2, double par4, double par6, float par8, float par9)
    019        {
    020            int var10 = ((ModelBat)this.mainModel).func_82889_a();
    021
    022            if (var10 != this.field_82446_a)
    023            {
    024                this.field_82446_a = var10;
    025                this.mainModel = new ModelBat();
    026            }
    027
    028            super.doRenderLiving(par1EntityBat, par2, par4, par6, par8, par9);
    029        }
    030
    031        protected void func_82442_a(EntityBat par1EntityBat, float par2)
    032        {
    033            GL11.glScalef(0.35F, 0.35F, 0.35F);
    034        }
    035
    036        protected void func_82445_a(EntityBat par1EntityBat, double par2, double par4, double par6)
    037        {
    038            super.renderLivingAt(par1EntityBat, par2, par4, par6);
    039        }
    040
    041        protected void func_82444_a(EntityBat par1EntityBat, float par2, float par3, float par4)
    042        {
    043            if (!par1EntityBat.func_82235_h())
    044            {
    045                GL11.glTranslatef(0.0F, MathHelper.cos(par2 * 0.3F) * 0.1F, 0.0F);
    046            }
    047            else
    048            {
    049                GL11.glTranslatef(0.0F, -0.1F, 0.0F);
    050            }
    051
    052            super.rotateCorpse(par1EntityBat, par2, par3, par4);
    053        }
    054
    055        /**
    056         * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
    057         * entityLiving, partialTickTime
    058         */
    059        protected void preRenderCallback(EntityLiving par1EntityLiving, float par2)
    060        {
    061            this.func_82442_a((EntityBat)par1EntityLiving, par2);
    062        }
    063
    064        protected void rotateCorpse(EntityLiving par1EntityLiving, float par2, float par3, float par4)
    065        {
    066            this.func_82444_a((EntityBat)par1EntityLiving, par2, par3, par4);
    067        }
    068
    069        /**
    070         * Sets a simple glTranslate on a LivingEntity.
    071         */
    072        protected void renderLivingAt(EntityLiving par1EntityLiving, double par2, double par4, double par6)
    073        {
    074            this.func_82445_a((EntityBat)par1EntityLiving, par2, par4, par6);
    075        }
    076
    077        public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
    078        {
    079            this.func_82443_a((EntityBat)par1EntityLiving, par2, par4, par6, par8, par9);
    080        }
    081
    082        /**
    083         * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
    084         * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
    085         * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
    086         * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
    087         */
    088        public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
    089        {
    090            this.func_82443_a((EntityBat)par1Entity, par2, par4, par6, par8, par9);
    091        }
    092    }