| 1 | package net.minecraft.client.particle;
|
| 2 |
|
| 3 | import net.minecraft.client.renderer.WorldRenderer;
|
| 4 | import net.minecraft.entity.Entity;
|
| 5 | import net.minecraft.util.MathHelper;
|
| 6 | import net.minecraft.world.World;
|
| 7 |
|
| 8 | public class EntitySnowShovelFX extends EntityFX
|
| 9 | {
|
| 10 | float snowDigParticleScale;
|
| 11 |
|
| 12 | protected EntitySnowShovelFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn)
|
| 13 | {
|
| 14 | this(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, 1.0F);
|
| 15 | }
|
| 16 |
|
| 17 | protected EntitySnowShovelFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, float p_i1228_14_)
|
| 18 | {
|
| 19 | super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
|
| 20 | this.motionX *= 0.10000000149011612D;
|
| 21 | this.motionY *= 0.10000000149011612D;
|
| 22 | this.motionZ *= 0.10000000149011612D;
|
| 23 | this.motionX += xSpeedIn;
|
| 24 | this.motionY += ySpeedIn;
|
| 25 | this.motionZ += zSpeedIn;
|
| 26 | this.particleRed = this.particleGreen = this.particleBlue = 1.0F - (float)(Math.random() * 0.30000001192092896D);
|
| 27 | this.particleScale *= 0.75F;
|
| 28 | this.particleScale *= p_i1228_14_;
|
| 29 | this.snowDigParticleScale = this.particleScale;
|
| 30 | this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
|
| 31 | this.particleMaxAge = (int)((float)this.particleMaxAge * p_i1228_14_);
|
| 32 | this.noClip = false;
|
| 33 | }
|
| 34 |
|
| 35 | /**
|
| 36 | * Renders the particle
|
| 37 | */
|
| 38 | public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
|
| 39 | {
|
| 40 | float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
|
| 41 | f = MathHelper.clamp_float(f, 0.0F, 1.0F);
|
| 42 | this.particleScale = this.snowDigParticleScale * f;
|
| 43 | super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
|
| 44 | }
|
| 45 |
|
| 46 | /**
|
| 47 | * Called to update the entity's position/logic.
|
| 48 | */
|
| 49 | public void onUpdate()
|
| 50 | {
|
| 51 | this.prevPosX = this.posX;
|
| 52 | this.prevPosY = this.posY;
|
| 53 | this.prevPosZ = this.posZ;
|
| 54 |
|
| 55 | if (this.particleAge++ >= this.particleMaxAge)
|
| 56 | {
|
| 57 | this.setDead();
|
| 58 | }
|
| 59 |
|
| 60 | this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge);
|
| 61 | this.motionY -= 0.03D;
|
| 62 | this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
| 63 | this.motionX *= 0.9900000095367432D;
|
| 64 | this.motionY *= 0.9900000095367432D;
|
| 65 | this.motionZ *= 0.9900000095367432D;
|
| 66 |
|
| 67 | if (this.onGround)
|
| 68 | {
|
| 69 | this.motionX *= 0.699999988079071D;
|
| 70 | this.motionZ *= 0.699999988079071D;
|
| 71 | }
|
| 72 | }
|
| 73 |
|
| 74 | public static class Factory implements IParticleFactory
|
| 75 | {
|
| 76 | public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
|
| 77 | {
|
| 78 | return new EntitySnowShovelFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
|
| 79 | }
|
| 80 | }
|
| 81 | }
|
| 82 |
|