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