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