Guest User

b

a guest
May 8th, 2015
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.26 KB | None | 0 0
  1. package com.svk.industrialGuns.client.particle;
  2.  
  3. import cpw.mods.fml.relauncher.Side;
  4. import cpw.mods.fml.relauncher.SideOnly;
  5. import net.minecraft.client.Minecraft;
  6. import net.minecraft.client.particle.EntityFX;
  7. import net.minecraft.client.renderer.Tessellator;
  8. import net.minecraft.world.World;
  9.  
  10. @SideOnly(Side.CLIENT)
  11. public class ParticleLava extends EntityFX
  12. {
  13.     private float lavaParticleScale;
  14.     private static final String __OBFID = "CL_00000912";
  15.  
  16.     public ParticleLava(World p_i1215_1_, double p_i1215_2_, double p_i1215_4_, double p_i1215_6_)
  17.     {
  18.         super(p_i1215_1_, p_i1215_2_, p_i1215_4_, p_i1215_6_, 0.0D, 0.0D, 0.0D);
  19.         this.motionX *= 0.800000011920929D;
  20.         this.motionY *= 0.800000011920929D;
  21.         this.motionZ *= 0.800000011920929D;
  22.         this.motionY = (double)(this.rand.nextFloat() * 0.4F + 0.05F);
  23.         this.particleRed = this.particleGreen = this.particleBlue = 1.0F;
  24.         this.particleScale *= this.rand.nextFloat() * 2.0F + 0.2F;
  25.         this.lavaParticleScale = this.particleScale;
  26.         this.particleMaxAge = (int)(16.0D / (Math.random() * 0.8D + 0.2D));
  27.         this.noClip = false;
  28.         this.setParticleTextureIndex(49);
  29.     }
  30.  
  31.     public int getBrightnessForRender(float p_70070_1_)
  32.     {
  33.         float f1 = ((float)this.particleAge + p_70070_1_) / (float)this.particleMaxAge;
  34.  
  35.         if (f1 < 0.0F)
  36.         {
  37.             f1 = 0.0F;
  38.         }
  39.  
  40.         if (f1 > 1.0F)
  41.         {
  42.             f1 = 1.0F;
  43.         }
  44.  
  45.         int i = super.getBrightnessForRender(p_70070_1_);
  46.         short short1 = 240;
  47.         int j = i >> 16 & 255;
  48.         return short1 | j << 16;
  49.     }
  50.  
  51.     /**
  52.      * Gets how bright this entity is.
  53.      */
  54.     public float getBrightness(float p_70013_1_)
  55.     {
  56.         return 1.0F;
  57.     }
  58.  
  59.     public void renderParticle(Tessellator p_70539_1_, float p_70539_2_, float p_70539_3_, float p_70539_4_, float p_70539_5_, float p_70539_6_, float p_70539_7_)
  60.     {
  61.         float f6 = ((float)this.particleAge + p_70539_2_) / (float)this.particleMaxAge;
  62.         this.particleScale = this.lavaParticleScale * (1.0F - f6 * f6);
  63.         super.renderParticle(p_70539_1_, p_70539_2_, p_70539_3_, p_70539_4_, p_70539_5_, p_70539_6_, p_70539_7_);
  64.     }
  65.  
  66.     /**
  67.      * Called to update the entity's position/logic.
  68.      */
  69.     public void onUpdate()
  70.     {
  71.         this.prevPosX = this.posX;
  72.         this.prevPosY = this.posY;
  73.         this.prevPosZ = this.posZ;
  74.  
  75.         if (this.particleAge++ >= this.particleMaxAge)
  76.         {
  77.             this.setDead();
  78.         }
  79.  
  80.         float f = (float)this.particleAge / (float)this.particleMaxAge;
  81.  
  82.         if (this.rand.nextFloat() > f)
  83.         {
  84.             Minecraft.getMinecraft().effectRenderer.addEffect(new ColoredParticleSmoke(this.worldObj, this.posX, this.posY, this.posZ, this.motionX, this.motionY, this.motionZ));
  85.         }
  86.  
  87.         this.motionY -= 0.03D;
  88.         this.moveEntity(this.motionX, this.motionY, this.motionZ);
  89.         this.motionX *= 0.9990000128746033D;
  90.         this.motionY *= 0.9990000128746033D;
  91.         this.motionZ *= 0.9990000128746033D;
  92.  
  93.         if (this.onGround)
  94.         {
  95.             this.motionX *= 0.699999988079071D;
  96.             this.motionZ *= 0.699999988079071D;
  97.         }
  98.     }
  99. }
Advertisement
Add Comment
Please, Sign In to add comment