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 RenderWither extends RenderLiving 009 { 010 private int field_82419_a; 011 012 public RenderWither() 013 { 014 super(new ModelWither(), 1.0F); 015 this.field_82419_a = ((ModelWither)this.mainModel).func_82903_a(); 016 } 017 018 public void func_82418_a(EntityWither par1EntityWither, double par2, double par4, double par6, float par8, float par9) 019 { 020 BossStatus.func_82824_a(par1EntityWither, true); 021 int var10 = ((ModelWither)this.mainModel).func_82903_a(); 022 023 if (var10 != this.field_82419_a) 024 { 025 this.field_82419_a = var10; 026 this.mainModel = new ModelWither(); 027 } 028 029 super.doRenderLiving(par1EntityWither, par2, par4, par6, par8, par9); 030 } 031 032 protected void func_82415_a(EntityWither par1EntityWither, float par2) 033 { 034 int var3 = par1EntityWither.func_82212_n(); 035 036 if (var3 > 0) 037 { 038 float var4 = 2.0F - ((float)var3 - par2) / 220.0F * 0.5F; 039 GL11.glScalef(var4, var4, var4); 040 } 041 else 042 { 043 GL11.glScalef(2.0F, 2.0F, 2.0F); 044 } 045 } 046 047 protected int func_82417_a(EntityWither par1EntityWither, int par2, float par3) 048 { 049 if (par1EntityWither.isArmored()) 050 { 051 if (par1EntityWither.func_82150_aj()) 052 { 053 GL11.glDepthMask(false); 054 } 055 else 056 { 057 GL11.glDepthMask(true); 058 } 059 060 if (par2 == 1) 061 { 062 float var4 = (float)par1EntityWither.ticksExisted + par3; 063 this.loadTexture("/armor/witherarmor.png"); 064 GL11.glMatrixMode(GL11.GL_TEXTURE); 065 GL11.glLoadIdentity(); 066 float var5 = MathHelper.cos(var4 * 0.02F) * 3.0F; 067 float var6 = var4 * 0.01F; 068 GL11.glTranslatef(var5, var6, 0.0F); 069 this.setRenderPassModel(this.mainModel); 070 GL11.glMatrixMode(GL11.GL_MODELVIEW); 071 GL11.glEnable(GL11.GL_BLEND); 072 float var7 = 0.5F; 073 GL11.glColor4f(var7, var7, var7, 1.0F); 074 GL11.glDisable(GL11.GL_LIGHTING); 075 GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); 076 GL11.glTranslatef(0.0F, -0.01F, 0.0F); 077 GL11.glScalef(1.1F, 1.1F, 1.1F); 078 return 1; 079 } 080 081 if (par2 == 2) 082 { 083 GL11.glMatrixMode(GL11.GL_TEXTURE); 084 GL11.glLoadIdentity(); 085 GL11.glMatrixMode(GL11.GL_MODELVIEW); 086 GL11.glEnable(GL11.GL_LIGHTING); 087 GL11.glDisable(GL11.GL_BLEND); 088 } 089 } 090 091 return -1; 092 } 093 094 protected int func_82416_b(EntityWither par1EntityWither, int par2, float par3) 095 { 096 return -1; 097 } 098 099 /** 100 * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: 101 * entityLiving, partialTickTime 102 */ 103 protected void preRenderCallback(EntityLiving par1EntityLiving, float par2) 104 { 105 this.func_82415_a((EntityWither)par1EntityLiving, par2); 106 } 107 108 /** 109 * Queries whether should render the specified pass or not. 110 */ 111 protected int shouldRenderPass(EntityLiving par1EntityLiving, int par2, float par3) 112 { 113 return this.func_82417_a((EntityWither)par1EntityLiving, par2, par3); 114 } 115 116 protected int inheritRenderPass(EntityLiving par1EntityLiving, int par2, float par3) 117 { 118 return this.func_82416_b((EntityWither)par1EntityLiving, par2, par3); 119 } 120 121 public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9) 122 { 123 this.func_82418_a((EntityWither)par1EntityLiving, par2, par4, par6, par8, par9); 124 } 125 126 /** 127 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then 128 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic 129 * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1, 130 * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. 131 */ 132 public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) 133 { 134 this.func_82418_a((EntityWither)par1Entity, par2, par4, par6, par8, par9); 135 } 136 }