| 1 | package net.minecraft.client.particle;
|
| 2 |
|
| 3 | import net.minecraft.block.material.Material;
|
| 4 | import net.minecraft.util.BlockPos;
|
| 5 | import net.minecraft.world.World;
|
| 6 |
|
| 7 | public class EntityBubbleFX extends EntityFX
|
| 8 | {
|
| 9 | protected EntityBubbleFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn)
|
| 10 | {
|
| 11 | super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
|
| 12 | this.particleRed = 1.0F;
|
| 13 | this.particleGreen = 1.0F;
|
| 14 | this.particleBlue = 1.0F;
|
| 15 | this.setParticleTextureIndex(32);
|
| 16 | this.setSize(0.02F, 0.02F);
|
| 17 | this.particleScale *= this.rand.nextFloat() * 0.6F + 0.2F;
|
| 18 | this.motionX = xSpeedIn * 0.20000000298023224D + (Math.random() * 2.0D - 1.0D) * 0.019999999552965164D;
|
| 19 | this.motionY = ySpeedIn * 0.20000000298023224D + (Math.random() * 2.0D - 1.0D) * 0.019999999552965164D;
|
| 20 | this.motionZ = zSpeedIn * 0.20000000298023224D + (Math.random() * 2.0D - 1.0D) * 0.019999999552965164D;
|
| 21 | this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
|
| 22 | }
|
| 23 |
|
| 24 | /**
|
| 25 | * Called to update the entity's position/logic.
|
| 26 | */
|
| 27 | public void onUpdate()
|
| 28 | {
|
| 29 | this.prevPosX = this.posX;
|
| 30 | this.prevPosY = this.posY;
|
| 31 | this.prevPosZ = this.posZ;
|
| 32 | this.motionY += 0.002D;
|
| 33 | this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
| 34 | this.motionX *= 0.8500000238418579D;
|
| 35 | this.motionY *= 0.8500000238418579D;
|
| 36 | this.motionZ *= 0.8500000238418579D;
|
| 37 |
|
| 38 | if (this.worldObj.getBlockState(new BlockPos(this)).getBlock().getMaterial() != Material.water)
|
| 39 | {
|
| 40 | this.setDead();
|
| 41 | }
|
| 42 |
|
| 43 | if (this.particleMaxAge-- <= 0)
|
| 44 | {
|
| 45 | this.setDead();
|
| 46 | }
|
| 47 | }
|
| 48 |
|
| 49 | public static class Factory implements IParticleFactory
|
| 50 | {
|
| 51 | public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
|
| 52 | {
|
| 53 | return new EntityBubbleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
|
| 54 | }
|
| 55 | }
|
| 56 | }
|
| 57 |
|