package game.renderer.particle; import game.entity.Entity; import game.renderer.RenderBuffer; import game.util.ExtMath; import game.world.World; public class EntityCrit2FX extends EntityFX { float field_174839_a; protected EntityCrit2FX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46284_8_, double p_i46284_10_, double p_i46284_12_) { this(worldIn, xCoordIn, yCoordIn, zCoordIn, p_i46284_8_, p_i46284_10_, p_i46284_12_, 1.0F); } 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_) { super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D); this.motionX *= 0.10000000149011612D; this.motionY *= 0.10000000149011612D; this.motionZ *= 0.10000000149011612D; this.motionX += p_i46285_8_ * 0.4D; this.motionY += p_i46285_10_ * 0.4D; this.motionZ += p_i46285_12_ * 0.4D; this.particleRed = this.particleGreen = this.particleBlue = (float)(Math.random() * 0.30000001192092896D + 0.6000000238418579D); this.particleScale *= 0.75F; this.particleScale *= p_i46285_14_; this.field_174839_a = this.particleScale; this.particleMaxAge = (int)(6.0D / (Math.random() * 0.8D + 0.6D)); this.particleMaxAge = (int)((float)this.particleMaxAge * p_i46285_14_); this.noClip = false; this.setParticleTextureIndex(65); this.onUpdate(); } /** * Renders the particle */ public void renderParticle(RenderBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F; f = ExtMath.clampf(f, 0.0F, 1.0F); this.particleScale = this.field_174839_a * f; super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ); } /** * Called to update the entity's position/logic. */ public void onUpdate() { this.prevX = this.posX; this.prevY = this.posY; this.prevZ = this.posZ; if (this.particleAge++ >= this.particleMaxAge) { this.setDead(); } this.moveEntity(this.motionX, this.motionY, this.motionZ); this.particleGreen = (float)((double)this.particleGreen * 0.96D); this.particleBlue = (float)((double)this.particleBlue * 0.9D); this.motionX *= 0.699999988079071D; this.motionY *= 0.699999988079071D; this.motionZ *= 0.699999988079071D; this.motionY -= 0.019999999552965164D; if (this.onGround) { this.motionX *= 0.699999988079071D; this.motionZ *= 0.699999988079071D; } } public static class Factory implements IParticleFactory { public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) { return new EntityCrit2FX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); } } public static class MagicFactory implements IParticleFactory { public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) { EntityFX entityfx = new EntityCrit2FX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); entityfx.setRBGColorF(entityfx.getRedColorF() * 0.3F, entityfx.getGreenColorF() * 0.8F, entityfx.getBlueColorF()); entityfx.nextTextureIndexX(); return entityfx; } } }