    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 EntityLargeExplodeFX extends EntityFX
    009    {
    010        private int field_70581_a = 0;
    011        private int field_70584_aq = 0;
    012
    013        /** The Rendering Engine. */
    014        private RenderEngine theRenderEngine;
    015        private float field_70582_as;
    016
    017        public EntityLargeExplodeFX(RenderEngine par1RenderEngine, World par2World, double par3, double par5, double par7, double par9, double par11, double par13)
    018        {
    019            super(par2World, par3, par5, par7, 0.0D, 0.0D, 0.0D);
    020            this.theRenderEngine = par1RenderEngine;
    021            this.field_70584_aq = 6 + this.rand.nextInt(4);
    022            this.particleRed = this.particleGreen = this.particleBlue = this.rand.nextFloat() * 0.6F + 0.4F;
    023            this.field_70582_as = 1.0F - (float)par9 * 0.5F;
    024        }
    025
    026        public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
    027        {
    028            int var8 = (int)(((float)this.field_70581_a + par2) * 15.0F / (float)this.field_70584_aq);
    029
    030            if (var8 <= 15)
    031            {
    032                this.theRenderEngine.bindTexture(this.theRenderEngine.getTexture("/misc/explosion.png"));
    033                float var9 = (float)(var8 % 4) / 4.0F;
    034                float var10 = var9 + 0.24975F;
    035                float var11 = (float)(var8 / 4) / 4.0F;
    036                float var12 = var11 + 0.24975F;
    037                float var13 = 2.0F * this.field_70582_as;
    038                float var14 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX);
    039                float var15 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY);
    040                float var16 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ);
    041                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    042                GL11.glDisable(GL11.GL_LIGHTING);
    043                RenderHelper.disableStandardItemLighting();
    044                par1Tessellator.startDrawingQuads();
    045                par1Tessellator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, 1.0F);
    046                par1Tessellator.setNormal(0.0F, 1.0F, 0.0F);
    047                par1Tessellator.setBrightness(240);
    048                par1Tessellator.addVertexWithUV((double)(var14 - par3 * var13 - par6 * var13), (double)(var15 - par4 * var13), (double)(var16 - par5 * var13 - par7 * var13), (double)var10, (double)var12);
    049                par1Tessellator.addVertexWithUV((double)(var14 - par3 * var13 + par6 * var13), (double)(var15 + par4 * var13), (double)(var16 - par5 * var13 + par7 * var13), (double)var10, (double)var11);
    050                par1Tessellator.addVertexWithUV((double)(var14 + par3 * var13 + par6 * var13), (double)(var15 + par4 * var13), (double)(var16 + par5 * var13 + par7 * var13), (double)var9, (double)var11);
    051                par1Tessellator.addVertexWithUV((double)(var14 + par3 * var13 - par6 * var13), (double)(var15 - par4 * var13), (double)(var16 + par5 * var13 - par7 * var13), (double)var9, (double)var12);
    052                par1Tessellator.draw();
    053                GL11.glPolygonOffset(0.0F, 0.0F);
    054                GL11.glEnable(GL11.GL_LIGHTING);
    055            }
    056        }
    057
    058        public int getBrightnessForRender(float par1)
    059        {
    060            return 61680;
    061        }
    062
    063        /**
    064         * Called to update the entity's position/logic.
    065         */
    066        public void onUpdate()
    067        {
    068            this.prevPosX = this.posX;
    069            this.prevPosY = this.posY;
    070            this.prevPosZ = this.posZ;
    071            ++this.field_70581_a;
    072
    073            if (this.field_70581_a == this.field_70584_aq)
    074            {
    075                this.setDead();
    076            }
    077        }
    078
    079        public int getFXLayer()
    080        {
    081            return 3;
    082        }
    083    }