    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 RenderMagmaCube extends RenderLiving
    009    {
    010        private int field_77120_a;
    011
    012        public RenderMagmaCube()
    013        {
    014            super(new ModelMagmaCube(), 0.25F);
    015            this.field_77120_a = ((ModelMagmaCube)this.mainModel).func_78107_a();
    016        }
    017
    018        public void renderMagmaCube(EntityMagmaCube par1EntityMagmaCube, double par2, double par4, double par6, float par8, float par9)
    019        {
    020            int var10 = ((ModelMagmaCube)this.mainModel).func_78107_a();
    021
    022            if (var10 != this.field_77120_a)
    023            {
    024                this.field_77120_a = var10;
    025                this.mainModel = new ModelMagmaCube();
    026                System.out.println("new lava slime model");
    027            }
    028
    029            super.doRenderLiving(par1EntityMagmaCube, par2, par4, par6, par8, par9);
    030        }
    031
    032        protected void scaleMagmaCube(EntityMagmaCube par1EntityMagmaCube, float par2)
    033        {
    034            int var3 = par1EntityMagmaCube.getSlimeSize();
    035            float var4 = (par1EntityMagmaCube.field_70812_c + (par1EntityMagmaCube.field_70811_b - par1EntityMagmaCube.field_70812_c) * par2) / ((float)var3 * 0.5F + 1.0F);
    036            float var5 = 1.0F / (var4 + 1.0F);
    037            float var6 = (float)var3;
    038            GL11.glScalef(var5 * var6, 1.0F / var5 * var6, var5 * var6);
    039        }
    040
    041        /**
    042         * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
    043         * entityLiving, partialTickTime
    044         */
    045        protected void preRenderCallback(EntityLiving par1EntityLiving, float par2)
    046        {
    047            this.scaleMagmaCube((EntityMagmaCube)par1EntityLiving, par2);
    048        }
    049
    050        public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
    051        {
    052            this.renderMagmaCube((EntityMagmaCube)par1EntityLiving, par2, par4, par6, par8, par9);
    053        }
    054
    055        /**
    056         * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
    057         * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
    058         * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
    059         * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
    060         */
    061        public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
    062        {
    063            this.renderMagmaCube((EntityMagmaCube)par1Entity, par2, par4, par6, par8, par9);
    064        }
    065    }