blob: dbfd18e51d747859eca81caedb415d690eb7ec4a [file] [log] [blame] [raw]
package com.legacy.aether.entities.particles;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class ParticleEvilWhirly extends AetherParticle {
float smokeParticleScale;
public ParticleEvilWhirly(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46347_8_, double p_i46347_10_, double p_i46347_12_) {
this(worldIn, xCoordIn, yCoordIn, zCoordIn, p_i46347_8_, p_i46347_10_, p_i46347_12_, 1.0F);
}
public ParticleEvilWhirly(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46348_8_, double p_i46348_10_, double p_i46348_12_, float p_i46348_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_i46348_8_;
this.motionY += p_i46348_10_;
this.motionZ += p_i46348_12_;
float f = (float) (Math.random() * 0.30000001192092896D);
this.particleRed = f;
this.particleGreen = f;
this.particleBlue = f;
this.particleScale *= 0.75F;
this.particleScale *= p_i46348_14_;
this.smokeParticleScale = this.particleScale;
this.particleMaxAge = (int) (8.0D / (Math.random() * 0.8D + 0.2D));
this.particleMaxAge = (int) ((float) this.particleMaxAge * p_i46348_14_);
}
/**
* Renders the particle
*/
public void renderParticle(Tessellator worldRendererIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
float f = ((float) this.particleAge + partialTicks) / (float) this.particleMaxAge * 32.0F;
f = MathHelper.clamp_float(f, 0.0F, 1.0F);
this.particleScale = this.smokeParticleScale * f;
super.renderParticle(worldRendererIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
public void onUpdate() {
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge) {
this.setDead();
}
this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge);
this.motionY += 0.004D;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
if (this.posY == this.prevPosY) {
this.motionX *= 1.1D;
this.motionZ *= 1.1D;
}
this.motionX *= 0.9599999785423279D;
this.motionY *= 0.9599999785423279D;
this.motionZ *= 0.9599999785423279D;
if (this.onGround) {
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
}