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