001 package net.minecraft.client.particle;
002
003 import cpw.mods.fml.relauncher.Side;
004 import cpw.mods.fml.relauncher.SideOnly;
005 import net.minecraft.world.World;
006
007 @SideOnly(Side.CLIENT)
008 public class EntityExplodeFX extends EntityFX
009 {
010 public EntityExplodeFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12)
011 {
012 super(par1World, par2, par4, par6, par8, par10, par12);
013 this.motionX = par8 + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.05F);
014 this.motionY = par10 + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.05F);
015 this.motionZ = par12 + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.05F);
016 this.particleRed = this.particleGreen = this.particleBlue = this.rand.nextFloat() * 0.3F + 0.7F;
017 this.particleScale = this.rand.nextFloat() * this.rand.nextFloat() * 6.0F + 1.0F;
018 this.particleMaxAge = (int)(16.0D / ((double)this.rand.nextFloat() * 0.8D + 0.2D)) + 2;
019 }
020
021 /**
022 * Called to update the entity's position/logic.
023 */
024 public void onUpdate()
025 {
026 this.prevPosX = this.posX;
027 this.prevPosY = this.posY;
028 this.prevPosZ = this.posZ;
029
030 if (this.particleAge++ >= this.particleMaxAge)
031 {
032 this.setDead();
033 }
034
035 this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge);
036 this.motionY += 0.004D;
037 this.moveEntity(this.motionX, this.motionY, this.motionZ);
038 this.motionX *= 0.8999999761581421D;
039 this.motionY *= 0.8999999761581421D;
040 this.motionZ *= 0.8999999761581421D;
041
042 if (this.onGround)
043 {
044 this.motionX *= 0.699999988079071D;
045 this.motionZ *= 0.699999988079071D;
046 }
047 }
048 }