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.block.material.Material;
006 import net.minecraft.util.MathHelper;
007 import net.minecraft.world.World;
008
009 @SideOnly(Side.CLIENT)
010 public class EntitySuspendFX extends EntityFX
011 {
012 public EntitySuspendFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12)
013 {
014 super(par1World, par2, par4 - 0.125D, par6, par8, par10, par12);
015 this.particleRed = 0.4F;
016 this.particleGreen = 0.4F;
017 this.particleBlue = 0.7F;
018 this.setParticleTextureIndex(0);
019 this.setSize(0.01F, 0.01F);
020 this.particleScale *= this.rand.nextFloat() * 0.6F + 0.2F;
021 this.motionX = par8 * 0.0D;
022 this.motionY = par10 * 0.0D;
023 this.motionZ = par12 * 0.0D;
024 this.particleMaxAge = (int)(16.0D / (Math.random() * 0.8D + 0.2D));
025 }
026
027 /**
028 * Called to update the entity's position/logic.
029 */
030 public void onUpdate()
031 {
032 this.prevPosX = this.posX;
033 this.prevPosY = this.posY;
034 this.prevPosZ = this.posZ;
035 this.moveEntity(this.motionX, this.motionY, this.motionZ);
036
037 if (this.worldObj.getBlockMaterial(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)) != Material.water)
038 {
039 this.setDead();
040 }
041
042 if (this.particleMaxAge-- <= 0)
043 {
044 this.setDead();
045 }
046 }
047 }