| 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 EntityHeartFX extends EntityFX
|
| 9 | {
|
| 10 | float particleScaleOverTime;
|
| 11 |
|
| 12 | protected EntityHeartFX(World worldIn, double p_i1211_2_, double p_i1211_4_, double p_i1211_6_, double p_i1211_8_, double p_i1211_10_, double p_i1211_12_)
|
| 13 | {
|
| 14 | this(worldIn, p_i1211_2_, p_i1211_4_, p_i1211_6_, p_i1211_8_, p_i1211_10_, p_i1211_12_, 2.0F);
|
| 15 | }
|
| 16 |
|
| 17 | protected EntityHeartFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46354_8_, double p_i46354_10_, double p_i46354_12_, float scale)
|
| 18 | {
|
| 19 | super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
|
| 20 | this.motionX *= 0.009999999776482582D;
|
| 21 | this.motionY *= 0.009999999776482582D;
|
| 22 | this.motionZ *= 0.009999999776482582D;
|
| 23 | this.motionY += 0.1D;
|
| 24 | this.particleScale *= 0.75F;
|
| 25 | this.particleScale *= scale;
|
| 26 | this.particleScaleOverTime = this.particleScale;
|
| 27 | this.particleMaxAge = 16;
|
| 28 | this.noClip = false;
|
| 29 | this.setParticleTextureIndex(80);
|
| 30 | }
|
| 31 |
|
| 32 | /**
|
| 33 | * Renders the particle
|
| 34 | */
|
| 35 | public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
|
| 36 | {
|
| 37 | float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
|
| 38 | f = MathHelper.clamp_float(f, 0.0F, 1.0F);
|
| 39 | this.particleScale = this.particleScaleOverTime * f;
|
| 40 | super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
|
| 41 | }
|
| 42 |
|
| 43 | /**
|
| 44 | * Called to update the entity's position/logic.
|
| 45 | */
|
| 46 | public void onUpdate()
|
| 47 | {
|
| 48 | this.prevPosX = this.posX;
|
| 49 | this.prevPosY = this.posY;
|
| 50 | this.prevPosZ = this.posZ;
|
| 51 |
|
| 52 | if (this.particleAge++ >= this.particleMaxAge)
|
| 53 | {
|
| 54 | this.setDead();
|
| 55 | }
|
| 56 |
|
| 57 | this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
| 58 |
|
| 59 | if (this.posY == this.prevPosY)
|
| 60 | {
|
| 61 | this.motionX *= 1.1D;
|
| 62 | this.motionZ *= 1.1D;
|
| 63 | }
|
| 64 |
|
| 65 | this.motionX *= 0.8600000143051147D;
|
| 66 | this.motionY *= 0.8600000143051147D;
|
| 67 | this.motionZ *= 0.8600000143051147D;
|
| 68 |
|
| 69 | if (this.onGround)
|
| 70 | {
|
| 71 | this.motionX *= 0.699999988079071D;
|
| 72 | this.motionZ *= 0.699999988079071D;
|
| 73 | }
|
| 74 | }
|
| 75 |
|
| 76 | public static class AngryVillagerFactory implements IParticleFactory
|
| 77 | {
|
| 78 | public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
|
| 79 | {
|
| 80 | EntityFX entityfx = new EntityHeartFX(worldIn, xCoordIn, yCoordIn + 0.5D, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
|
| 81 | entityfx.setParticleTextureIndex(81);
|
| 82 | entityfx.setRBGColorF(1.0F, 1.0F, 1.0F);
|
| 83 | return entityfx;
|
| 84 | }
|
| 85 | }
|
| 86 |
|
| 87 | public static class Factory implements IParticleFactory
|
| 88 | {
|
| 89 | public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
|
| 90 | {
|
| 91 | return new EntityHeartFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
|
| 92 | }
|
| 93 | }
|
| 94 | }
|
| 95 |
|