001package net.minecraft.client.gui;
002
003import cpw.mods.fml.relauncher.Side;
004import cpw.mods.fml.relauncher.SideOnly;
005import java.util.Random;
006
007@SideOnly(Side.CLIENT)
008public class Particle
009{
010    private static Random rand = new Random();
011    public double posX;
012    public double posY;
013    public double prevPosX;
014    public double prevPosY;
015    public double velocityX;
016    public double velocityY;
017    public double accelScale;
018    public boolean isDead;
019    public int timeTick;
020    public int timeLimit;
021    public double tintRed;
022    public double tintGreen;
023    public double tintBlue;
024    public double tintAlpha;
025    public double prevTintRed;
026    public double prevTintGreen;
027    public double prevTintBlue;
028    public double prevTintAlpha;
029
030    public void update(GuiParticle par1GuiParticle)
031    {
032        this.posX += this.velocityX;
033        this.posY += this.velocityY;
034        this.velocityX *= this.accelScale;
035        this.velocityY *= this.accelScale;
036        this.velocityY += 0.1D;
037
038        if (++this.timeTick > this.timeLimit)
039        {
040            this.setDead();
041        }
042
043        this.tintAlpha = 2.0D - (double)this.timeTick / (double)this.timeLimit * 2.0D;
044
045        if (this.tintAlpha > 1.0D)
046        {
047            this.tintAlpha = 1.0D;
048        }
049
050        this.tintAlpha *= this.tintAlpha;
051        this.tintAlpha *= 0.5D;
052    }
053
054    public void preUpdate()
055    {
056        this.prevTintRed = this.tintRed;
057        this.prevTintGreen = this.tintGreen;
058        this.prevTintBlue = this.tintBlue;
059        this.prevTintAlpha = this.tintAlpha;
060        this.prevPosX = this.posX;
061        this.prevPosY = this.posY;
062    }
063
064    public void setDead()
065    {
066        this.isDead = true;
067    }
068}