Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.anim8.gscraft.particles;
- import cpw.mods.fml.relauncher.Side;
- import cpw.mods.fml.relauncher.SideOnly;
- import net.minecraft.client.particle.EntityFX;
- import net.minecraft.client.renderer.Tessellator;
- import net.minecraft.world.World;
- @SideOnly(Side.CLIENT)
- public class EntityWhirlwindDustFX extends EntityFX
- {
- float particleScaleOverTime;
- private double entityCentreX, entityCentreY, entityCentreZ, distToCentre, secondsPerRevolution;
- private float tickCount;
- public EntityWhirlwindDustFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, double centreX, double centreY, double centreZ, double secs4Rev)
- {
- this(par1World, par2, par4, par6, par8, par10, par12, 1.0F, centreX, centreY, centreZ, secs4Rev);
- }
- public EntityWhirlwindDustFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, float par14, double centreX, double centreY, double centreZ, double secs4Rev)
- {
- super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D);
- this.secondsPerRevolution = secs4Rev;
- this.entityCentreX = centreX;
- this.entityCentreY = centreY;
- this.entityCentreZ = centreZ;
- this.distToCentre = Math.sqrt((posX - entityCentreX) * (posX - entityCentreX) + (posZ - entityCentreZ) * (posZ - entityCentreZ));
- this.particleRed = this.particleGreen = this.particleBlue = (float)(Math.random() * 0.30000001192092896D);
- this.particleScale *= 0.75F *2 ;
- this.particleScaleOverTime = this.particleScale;
- this.particleMaxAge = 32;
- this.setParticleTextureIndex(7);
- }
- public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
- {
- float f6 = ((float)this.particleAge + par2) / (float)this.particleMaxAge * 32.0F;
- if (f6 < 0.0F)
- {
- f6 = 0.0F;
- }
- if (f6 > 1.0F)
- {
- f6 = 1.0F;
- }
- this.particleScale = this.particleScaleOverTime * f6;
- super.renderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7);
- }
- public void onUpdate()
- {
- float maxAgeOverTime = this.particleAge / particleMaxAge;
- this.prevPosX = this.posX;
- this.prevPosY = this.posY;
- this.prevPosZ = this.posZ;
- if (this.particleAge++ >= this.particleMaxAge)
- {
- tickCount = 0;
- this.setDead();
- }
- tickCount++;
- this.posX = this.entityCentreX + distToCentre * Math.cos(2 * 3.141 * (tickCount / 20) / secondsPerRevolution);
- this.posZ = this.entityCentreZ + distToCentre * Math.sin(2 * 3.141 * (tickCount / 20) / secondsPerRevolution);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment