| 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 EntityCrit2FX extends EntityFX
|
| 9 | {
|
| 10 | float field_174839_a;
|
| 11 |
|
| 12 | protected EntityCrit2FX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46284_8_, double p_i46284_10_, double p_i46284_12_)
|
| 13 | {
|
| 14 | this(worldIn, xCoordIn, yCoordIn, zCoordIn, p_i46284_8_, p_i46284_10_, p_i46284_12_, 1.0F);
|
| 15 | }
|
| 16 |
|
| 17 | protected EntityCrit2FX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46285_8_, double p_i46285_10_, double p_i46285_12_, float p_i46285_14_)
|
| 18 | {
|
| 19 | super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
|
| 20 | this.motionX *= 0.10000000149011612D;
|
| 21 | this.motionY *= 0.10000000149011612D;
|
| 22 | this.motionZ *= 0.10000000149011612D;
|
| 23 | this.motionX += p_i46285_8_ * 0.4D;
|
| 24 | this.motionY += p_i46285_10_ * 0.4D;
|
| 25 | this.motionZ += p_i46285_12_ * 0.4D;
|
| 26 | this.particleRed = this.particleGreen = this.particleBlue = (float)(Math.random() * 0.30000001192092896D + 0.6000000238418579D);
|
| 27 | this.particleScale *= 0.75F;
|
| 28 | this.particleScale *= p_i46285_14_;
|
| 29 | this.field_174839_a = this.particleScale;
|
| 30 | this.particleMaxAge = (int)(6.0D / (Math.random() * 0.8D + 0.6D));
|
| 31 | this.particleMaxAge = (int)((float)this.particleMaxAge * p_i46285_14_);
|
| 32 | this.noClip = false;
|
| 33 | this.setParticleTextureIndex(65);
|
| 34 | this.onUpdate();
|
| 35 | }
|
| 36 |
|
| 37 | /**
|
| 38 | * Renders the particle
|
| 39 | */
|
| 40 | public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
|
| 41 | {
|
| 42 | float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
|
| 43 | f = MathHelper.clamp_float(f, 0.0F, 1.0F);
|
| 44 | this.particleScale = this.field_174839_a * f;
|
| 45 | super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
|
| 46 | }
|
| 47 |
|
| 48 | /**
|
| 49 | * Called to update the entity's position/logic.
|
| 50 | */
|
| 51 | public void onUpdate()
|
| 52 | {
|
| 53 | this.prevPosX = this.posX;
|
| 54 | this.prevPosY = this.posY;
|
| 55 | this.prevPosZ = this.posZ;
|
| 56 |
|
| 57 | if (this.particleAge++ >= this.particleMaxAge)
|
| 58 | {
|
| 59 | this.setDead();
|
| 60 | }
|
| 61 |
|
| 62 | this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
| 63 | this.particleGreen = (float)((double)this.particleGreen * 0.96D);
|
| 64 | this.particleBlue = (float)((double)this.particleBlue * 0.9D);
|
| 65 | this.motionX *= 0.699999988079071D;
|
| 66 | this.motionY *= 0.699999988079071D;
|
| 67 | this.motionZ *= 0.699999988079071D;
|
| 68 | this.motionY -= 0.019999999552965164D;
|
| 69 |
|
| 70 | if (this.onGround)
|
| 71 | {
|
| 72 | this.motionX *= 0.699999988079071D;
|
| 73 | this.motionZ *= 0.699999988079071D;
|
| 74 | }
|
| 75 | }
|
| 76 |
|
| 77 | public static class Factory implements IParticleFactory
|
| 78 | {
|
| 79 | public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
|
| 80 | {
|
| 81 | return new EntityCrit2FX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
|
| 82 | }
|
| 83 | }
|
| 84 |
|
| 85 | public static class MagicFactory implements IParticleFactory
|
| 86 | {
|
| 87 | public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
|
| 88 | {
|
| 89 | EntityFX entityfx = new EntityCrit2FX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
|
| 90 | entityfx.setRBGColorF(entityfx.getRedColorF() * 0.3F, entityfx.getGreenColorF() * 0.8F, entityfx.getBlueColorF());
|
| 91 | entityfx.nextTextureIndexX();
|
| 92 | return entityfx;
|
| 93 | }
|
| 94 | }
|
| 95 | }
|
| 96 |
|