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