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 EntityRainFX extends EntityFX
008    {
009        public EntityRainFX(World par1World, double par2, double par4, double par6)
010        {
011            super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D);
012            this.motionX *= 0.30000001192092896D;
013            this.motionY = (double)((float)Math.random() * 0.2F + 0.1F);
014            this.motionZ *= 0.30000001192092896D;
015            this.particleRed = 1.0F;
016            this.particleGreen = 1.0F;
017            this.particleBlue = 1.0F;
018            this.setParticleTextureIndex(19 + this.rand.nextInt(4));
019            this.setSize(0.01F, 0.01F);
020            this.particleGravity = 0.06F;
021            this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
022        }
023    
024        /**
025         * Called to update the entity's position/logic.
026         */
027        public void onUpdate()
028        {
029            this.prevPosX = this.posX;
030            this.prevPosY = this.posY;
031            this.prevPosZ = this.posZ;
032            this.motionY -= (double)this.particleGravity;
033            this.moveEntity(this.motionX, this.motionY, this.motionZ);
034            this.motionX *= 0.9800000190734863D;
035            this.motionY *= 0.9800000190734863D;
036            this.motionZ *= 0.9800000190734863D;
037    
038            if (this.particleMaxAge-- <= 0)
039            {
040                this.setDead();
041            }
042    
043            if (this.onGround)
044            {
045                if (Math.random() < 0.5D)
046                {
047                    this.setDead();
048                }
049    
050                this.motionX *= 0.699999988079071D;
051                this.motionZ *= 0.699999988079071D;
052            }
053    
054            Material var1 = this.worldObj.getBlockMaterial(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ));
055    
056            if (var1.isLiquid() || var1.isSolid())
057            {
058                double var2 = (double)((float)(MathHelper.floor_double(this.posY) + 1) - BlockFluid.getFluidHeightPercent(this.worldObj.getBlockMetadata(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ))));
059    
060                if (this.posY < var2)
061                {
062                    this.setDead();
063                }
064            }
065        }
066    }