    001package net.minecraft.client.particle;
    002
    003import cpw.mods.fml.relauncher.Side;
    004import cpw.mods.fml.relauncher.SideOnly;
    005import net.minecraft.client.renderer.RenderEngine;
    006import net.minecraft.client.renderer.RenderHelper;
    007import net.minecraft.client.renderer.Tessellator;
    008import net.minecraft.world.World;
    009import org.lwjgl.opengl.GL11;
    010
    011@SideOnly(Side.CLIENT)
    012public 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 i = (int)(((float)this.field_70581_a + par2) * 15.0F / (float)this.field_70584_aq);
    033
    034        if (i <= 15)
    035        {
    036            this.theRenderEngine.bindTexture("/misc/explosion.png");
    037            float f6 = (float)(i % 4) / 4.0F;
    038            float f7 = f6 + 0.24975F;
    039            float f8 = (float)(i / 4) / 4.0F;
    040            float f9 = f8 + 0.24975F;
    041            float f10 = 2.0F * this.field_70582_as;
    042            float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX);
    043            float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY);
    044            float f13 = (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)(f11 - par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 - par5 * f10 - par7 * f10), (double)f7, (double)f9);
    053            par1Tessellator.addVertexWithUV((double)(f11 - par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 - par5 * f10 + par7 * f10), (double)f7, (double)f8);
    054            par1Tessellator.addVertexWithUV((double)(f11 + par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 + par5 * f10 + par7 * f10), (double)f6, (double)f8);
    055            par1Tessellator.addVertexWithUV((double)(f11 + par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 + par5 * f10 - par7 * f10), (double)f6, (double)f9);
    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}