aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/entities/GT_EntityFXPollution.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/common/entities/GT_EntityFXPollution.java')
-rw-r--r--src/main/java/gregtech/common/entities/GT_EntityFXPollution.java65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/main/java/gregtech/common/entities/GT_EntityFXPollution.java b/src/main/java/gregtech/common/entities/GT_EntityFXPollution.java
new file mode 100644
index 0000000000..2123313190
--- /dev/null
+++ b/src/main/java/gregtech/common/entities/GT_EntityFXPollution.java
@@ -0,0 +1,65 @@
+package gregtech.common.entities;
+
+import cofh.lib.util.helpers.MathHelper;
+import net.minecraft.client.particle.EntityFX;
+import net.minecraft.world.World;
+
+import java.util.Random;
+
+public class GT_EntityFXPollution extends EntityFX {
+
+ public GT_EntityFXPollution(World world, double x, double y, double z) {
+ super(world, x, y, z,0 ,0 ,0);
+
+ this.particleRed = 0.25F;
+ this.particleGreen = 0.2F;
+ this.particleBlue = 0.25F;
+
+ this.motionX *= 0.1D;
+ this.motionY *= -0.1D;
+ this.motionZ *= 0.1F;
+
+ Random random = world.rand;
+ this.motionX += random.nextFloat() * -1.9D * random.nextFloat() * 0.1D;
+ this.motionY += random.nextFloat() * -0.5D * random.nextFloat() * 0.1D * 5.0D;
+ this.motionZ += random.nextFloat() * -1.9D * random.nextFloat() * 0.1D;
+
+ this.particleTextureIndexX = 0;
+ this.particleTextureIndexY = 0;
+
+ this.particleMaxAge = (int)((double)20 / ((double)random.nextFloat() * 0.8D + 0.2D));
+
+ this.particleScale *= 0.75F;
+ this.noClip = true;
+ }
+
+ @Override
+ public void onUpdate() {
+ this.prevPosX = this.posX;
+ this.prevPosY = this.posY;
+ this.prevPosZ = this.posZ;
+
+ if (this.particleAge++ >= this.particleMaxAge) {
+ this.setDead();
+ } else {
+ this.motionY += -5.0E-4D;
+ 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.7D;
+ this.motionZ *= 0.7D;
+ }
+ }
+ }
+
+
+ public float getSize(float tickDelta) {
+ return this.particleScale * MathHelper.clamp(((float)this.particleAge + tickDelta) / (float)this.particleMaxAge * 32.0F, 0.0F, 1.0F);
+ }
+}