001 package net.minecraft.src; 002 003 import cpw.mods.fml.common.Side; 004 import cpw.mods.fml.common.asm.SideOnly; 005 006 @SideOnly(Side.CLIENT) 007 public class EntityLavaFX extends EntityFX 008 { 009 private float lavaParticleScale; 010 011 public EntityLavaFX(World par1World, double par2, double par4, double par6) 012 { 013 super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D); 014 this.motionX *= 0.800000011920929D; 015 this.motionY *= 0.800000011920929D; 016 this.motionZ *= 0.800000011920929D; 017 this.motionY = (double)(this.rand.nextFloat() * 0.4F + 0.05F); 018 this.particleRed = this.particleGreen = this.particleBlue = 1.0F; 019 this.particleScale *= this.rand.nextFloat() * 2.0F + 0.2F; 020 this.lavaParticleScale = this.particleScale; 021 this.particleMaxAge = (int)(16.0D / (Math.random() * 0.8D + 0.2D)); 022 this.noClip = false; 023 this.setParticleTextureIndex(49); 024 } 025 026 public int getBrightnessForRender(float par1) 027 { 028 float var2 = ((float)this.particleAge + par1) / (float)this.particleMaxAge; 029 030 if (var2 < 0.0F) 031 { 032 var2 = 0.0F; 033 } 034 035 if (var2 > 1.0F) 036 { 037 var2 = 1.0F; 038 } 039 040 int var3 = super.getBrightnessForRender(par1); 041 short var4 = 240; 042 int var5 = var3 >> 16 & 255; 043 return var4 | var5 << 16; 044 } 045 046 /** 047 * Gets how bright this entity is. 048 */ 049 public float getBrightness(float par1) 050 { 051 return 1.0F; 052 } 053 054 public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) 055 { 056 float var8 = ((float)this.particleAge + par2) / (float)this.particleMaxAge; 057 this.particleScale = this.lavaParticleScale * (1.0F - var8 * var8); 058 super.renderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7); 059 } 060 061 /** 062 * Called to update the entity's position/logic. 063 */ 064 public void onUpdate() 065 { 066 this.prevPosX = this.posX; 067 this.prevPosY = this.posY; 068 this.prevPosZ = this.posZ; 069 070 if (this.particleAge++ >= this.particleMaxAge) 071 { 072 this.setDead(); 073 } 074 075 float var1 = (float)this.particleAge / (float)this.particleMaxAge; 076 077 if (this.rand.nextFloat() > var1) 078 { 079 this.worldObj.spawnParticle("smoke", this.posX, this.posY, this.posZ, this.motionX, this.motionY, this.motionZ); 080 } 081 082 this.motionY -= 0.03D; 083 this.moveEntity(this.motionX, this.motionY, this.motionZ); 084 this.motionX *= 0.9990000128746033D; 085 this.motionY *= 0.9990000128746033D; 086 this.motionZ *= 0.9990000128746033D; 087 088 if (this.onGround) 089 { 090 this.motionX *= 0.699999988079071D; 091 this.motionZ *= 0.699999988079071D; 092 } 093 } 094 }