/*
* Copyright (c) CovertJaguar, 2014 http://railcraft.info
*
* This code is the property of CovertJaguar
* and may only be used with explicit written
* permission unless otherwise specified on the
* license page at http://railcraft.info/wiki/info:license.
*/
package mods.railcraft.client.particles;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.world.World;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public class EntitySimpleParticleFX extends EntityFX {
public double gravity = 0.004D;
public EntitySimpleParticleFX(World par1World, double x, double y, double z) {
this(par1World, x, y, z, 0, 0, 0, 3f);
}
public EntitySimpleParticleFX(World par1World, double x, double y, double z, double velX, double velY, double velZ, float scale) {
super(par1World, x, y, z, 0.0D, 0.0D, 0.0D);
this.motionX *= 0.1;
this.motionY *= 0.1;
this.motionZ *= 0.1;
this.motionX += velX;
this.motionY += velY;
this.motionZ += velZ;
this.particleScale *= 0.75F;
this.particleScale *= scale;
this.particleMaxAge = (int) (24.0D / (Math.random() * 0.5D + 0.2D));
this.particleMaxAge = (int) (this.particleMaxAge * scale);
this.noClip = true;
}
/**
* Called to update the entity's position/logic.
*/
@Override
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 += gravity;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
if (this.posY == this.prevPosY) {
this.motionX *= 1.1D;
this.motionZ *= 1.1D;
}
this.motionX *= 0.96D;
this.motionY *= 0.96D;
this.motionZ *= 0.96D;
if (this.onGround) {
this.motionX *= 0.67D;
this.motionZ *= 0.67D;
}
}
}