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 RenderTNTPrimed extends Render 009 { 010 private RenderBlocks blockRenderer = new RenderBlocks(); 011 012 public RenderTNTPrimed() 013 { 014 this.shadowSize = 0.5F; 015 } 016 017 public void func_76992_a(EntityTNTPrimed par1EntityTNTPrimed, double par2, double par4, double par6, float par8, float par9) 018 { 019 GL11.glPushMatrix(); 020 GL11.glTranslatef((float)par2, (float)par4, (float)par6); 021 float var10; 022 023 if ((float)par1EntityTNTPrimed.fuse - par9 + 1.0F < 10.0F) 024 { 025 var10 = 1.0F - ((float)par1EntityTNTPrimed.fuse - par9 + 1.0F) / 10.0F; 026 027 if (var10 < 0.0F) 028 { 029 var10 = 0.0F; 030 } 031 032 if (var10 > 1.0F) 033 { 034 var10 = 1.0F; 035 } 036 037 var10 *= var10; 038 var10 *= var10; 039 float var11 = 1.0F + var10 * 0.3F; 040 GL11.glScalef(var11, var11, var11); 041 } 042 043 var10 = (1.0F - ((float)par1EntityTNTPrimed.fuse - par9 + 1.0F) / 100.0F) * 0.8F; 044 this.loadTexture("/terrain.png"); 045 this.blockRenderer.renderBlockAsItem(Block.tnt, 0, par1EntityTNTPrimed.getBrightness(par9)); 046 047 if (par1EntityTNTPrimed.fuse / 5 % 2 == 0) 048 { 049 GL11.glDisable(GL11.GL_TEXTURE_2D); 050 GL11.glDisable(GL11.GL_LIGHTING); 051 GL11.glEnable(GL11.GL_BLEND); 052 GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA); 053 GL11.glColor4f(1.0F, 1.0F, 1.0F, var10); 054 this.blockRenderer.renderBlockAsItem(Block.tnt, 0, 1.0F); 055 GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); 056 GL11.glDisable(GL11.GL_BLEND); 057 GL11.glEnable(GL11.GL_LIGHTING); 058 GL11.glEnable(GL11.GL_TEXTURE_2D); 059 } 060 061 GL11.glPopMatrix(); 062 } 063 064 /** 065 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then 066 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic 067 * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1, 068 * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. 069 */ 070 public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) 071 { 072 this.func_76992_a((EntityTNTPrimed)par1Entity, par2, par4, par6, par8, par9); 073 } 074 }