| 1 | package net.minecraft.client.particle;
|
| 2 |
|
| 3 | import net.minecraft.world.World;
|
| 4 |
|
| 5 | public class EntityExplodeFX extends EntityFX
|
| 6 | {
|
| 7 | protected EntityExplodeFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn)
|
| 8 | {
|
| 9 | super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
|
| 10 | this.motionX = xSpeedIn + (Math.random() * 2.0D - 1.0D) * 0.05000000074505806D;
|
| 11 | this.motionY = ySpeedIn + (Math.random() * 2.0D - 1.0D) * 0.05000000074505806D;
|
| 12 | this.motionZ = zSpeedIn + (Math.random() * 2.0D - 1.0D) * 0.05000000074505806D;
|
| 13 | this.particleRed = this.particleGreen = this.particleBlue = this.rand.nextFloat() * 0.3F + 0.7F;
|
| 14 | this.particleScale = this.rand.nextFloat() * this.rand.nextFloat() * 6.0F + 1.0F;
|
| 15 | this.particleMaxAge = (int)(16.0D / ((double)this.rand.nextFloat() * 0.8D + 0.2D)) + 2;
|
| 16 | }
|
| 17 |
|
| 18 | /**
|
| 19 | * Called to update the entity's position/logic.
|
| 20 | */
|
| 21 | public void onUpdate()
|
| 22 | {
|
| 23 | this.prevPosX = this.posX;
|
| 24 | this.prevPosY = this.posY;
|
| 25 | this.prevPosZ = this.posZ;
|
| 26 |
|
| 27 | if (this.particleAge++ >= this.particleMaxAge)
|
| 28 | {
|
| 29 | this.setDead();
|
| 30 | }
|
| 31 |
|
| 32 | this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge);
|
| 33 | this.motionY += 0.004D;
|
| 34 | this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
| 35 | this.motionX *= 0.8999999761581421D;
|
| 36 | this.motionY *= 0.8999999761581421D;
|
| 37 | this.motionZ *= 0.8999999761581421D;
|
| 38 |
|
| 39 | if (this.onGround)
|
| 40 | {
|
| 41 | this.motionX *= 0.699999988079071D;
|
| 42 | this.motionZ *= 0.699999988079071D;
|
| 43 | }
|
| 44 | }
|
| 45 |
|
| 46 | public static class Factory implements IParticleFactory
|
| 47 | {
|
| 48 | public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
|
| 49 | {
|
| 50 | return new EntityExplodeFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
|
| 51 | }
|
| 52 | }
|
| 53 | }
|
| 54 |
|