diff options
| author | moller21 <42100910+moller21@users.noreply.github.com> | 2020-07-19 19:08:59 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-19 19:08:59 +0200 |
| commit | 8ce4ae8d22f31587c600bf8190cfb88e1a4f2ea2 (patch) | |
| tree | 5f5d4fa32fc17e4029a8d31f209a193610c4b232 /src/main/java/gregtech/common/entities | |
| parent | b12ebd30b3d2199dfeca0deeaa36353dcf57e006 (diff) | |
| download | GT5-Unofficial-8ce4ae8d22f31587c600bf8190cfb88e1a4f2ea2.tar.gz GT5-Unofficial-8ce4ae8d22f31587c600bf8190cfb88e1a4f2ea2.tar.bz2 GT5-Unofficial-8ce4ae8d22f31587c600bf8190cfb88e1a4f2ea2.zip | |
Rework clientside pollution (#302)
* Rework clientside pollution
* Pollution rework
* removed debug
Diffstat (limited to 'src/main/java/gregtech/common/entities')
| -rw-r--r-- | src/main/java/gregtech/common/entities/GT_EntityFXPollution.java | 65 |
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); + } +} |
