| 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 EntityNoteFX extends EntityFX
|
| 9 | {
|
| 10 | float noteParticleScale;
|
| 11 |
|
| 12 | protected EntityNoteFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46353_8_, double p_i46353_10_, double p_i46353_12_)
|
| 13 | {
|
| 14 | this(worldIn, xCoordIn, yCoordIn, zCoordIn, p_i46353_8_, p_i46353_10_, p_i46353_12_, 2.0F);
|
| 15 | }
|
| 16 |
|
| 17 | protected EntityNoteFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i1217_8_, double p_i1217_10_, double p_i1217_12_, float p_i1217_14_)
|
| 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.2D;
|
| 24 | this.particleRed = MathHelper.sin(((float)p_i1217_8_ + 0.0F) * (float)Math.PI * 2.0F) * 0.65F + 0.35F;
|
| 25 | this.particleGreen = MathHelper.sin(((float)p_i1217_8_ + 0.33333334F) * (float)Math.PI * 2.0F) * 0.65F + 0.35F;
|
| 26 | this.particleBlue = MathHelper.sin(((float)p_i1217_8_ + 0.6666667F) * (float)Math.PI * 2.0F) * 0.65F + 0.35F;
|
| 27 | this.particleScale *= 0.75F;
|
| 28 | this.particleScale *= p_i1217_14_;
|
| 29 | this.noteParticleScale = this.particleScale;
|
| 30 | this.particleMaxAge = 6;
|
| 31 | this.noClip = false;
|
| 32 | this.setParticleTextureIndex(64);
|
| 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.noteParticleScale * 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.moveEntity(this.motionX, this.motionY, this.motionZ);
|
| 61 |
|
| 62 | if (this.posY == this.prevPosY)
|
| 63 | {
|
| 64 | this.motionX *= 1.1D;
|
| 65 | this.motionZ *= 1.1D;
|
| 66 | }
|
| 67 |
|
| 68 | this.motionX *= 0.6600000262260437D;
|
| 69 | this.motionY *= 0.6600000262260437D;
|
| 70 | this.motionZ *= 0.6600000262260437D;
|
| 71 |
|
| 72 | if (this.onGround)
|
| 73 | {
|
| 74 | this.motionX *= 0.699999988079071D;
|
| 75 | this.motionZ *= 0.699999988079071D;
|
| 76 | }
|
| 77 | }
|
| 78 |
|
| 79 | public static class Factory implements IParticleFactory
|
| 80 | {
|
| 81 | public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
|
| 82 | {
|
| 83 | return new EntityNoteFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
|
| 84 | }
|
| 85 | }
|
| 86 | }
|
| 87 |
|