package net.minecraft.src;
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.

// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode 

import java.util.Random;

public class EntityBubbleFX extends EntityFX {

	public EntityBubbleFX(World world, double d, double d1, double d2, double d3, double d4, double d5) {
		super(world, d, d1, d2, d3, d4, d5);
		particleRed = 1.0F;
		particleGreen = 1.0F;
		particleBlue = 1.0F;
		particleTextureIndex = 32;
		setSize(0.02F, 0.02F);
		particleScale = particleScale * (rand.nextFloat() * 0.6F + 0.2F);
		motionX = d3 * 0.20000000298023224D + (double) ((float) (Math.random() * 2D - 1.0D) * 0.02F);
		motionY = d4 * 0.20000000298023224D + (double) ((float) (Math.random() * 2D - 1.0D) * 0.02F);
		motionZ = d5 * 0.20000000298023224D + (double) ((float) (Math.random() * 2D - 1.0D) * 0.02F);
		particleMaxAge = (int) (8D / (Math.random() * 0.80000000000000004D + 0.20000000000000001D));
	}

	public void onUpdate() {
		prevPosX = posX;
		prevPosY = posY;
		prevPosZ = posZ;
		motionY += 0.002D;
		moveEntity(motionX, motionY, motionZ);
		motionX *= 0.85000002384185791D;
		motionY *= 0.85000002384185791D;
		motionZ *= 0.85000002384185791D;
		if (worldObj.getBlockMaterial(MathHelper.floor_double(posX), MathHelper.floor_double(posY),
				MathHelper.floor_double(posZ)) != Material.water) {
			setEntityDead();
		}
		if (particleMaxAge-- <= 0) {
			setEntityDead();
		}
	}
}
