package net.minecraft.client.particle; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.BlockLiquid; import net.minecraft.block.material.Material; import net.minecraft.util.MathHelper; import net.minecraft.world.World; @SideOnly(Side.CLIENT) public class EntityRainFX extends EntityFX { private static final String __OBFID = "CL_00000934"; public EntityRainFX(World p_i1235_1_, double p_i1235_2_, double p_i1235_4_, double p_i1235_6_) { super(p_i1235_1_, p_i1235_2_, p_i1235_4_, p_i1235_6_, 0.0D, 0.0D, 0.0D); this.motionX *= 0.30000001192092896D; this.motionY = (double)((float)Math.random() * 0.2F + 0.1F); this.motionZ *= 0.30000001192092896D; this.particleRed = 1.0F; this.particleGreen = 1.0F; this.particleBlue = 1.0F; this.setParticleTextureIndex(19 + this.rand.nextInt(4)); this.setSize(0.01F, 0.01F); this.particleGravity = 0.06F; this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)); } /** * Called to update the entity's position/logic. */ public void onUpdate() { this.prevPosX = this.posX; this.prevPosY = this.posY; this.prevPosZ = this.posZ; this.motionY -= (double)this.particleGravity; this.moveEntity(this.motionX, this.motionY, this.motionZ); this.motionX *= 0.9800000190734863D; this.motionY *= 0.9800000190734863D; this.motionZ *= 0.9800000190734863D; if (this.particleMaxAge-- <= 0) { this.setDead(); } if (this.onGround) { if (Math.random() < 0.5D) { this.setDead(); } this.motionX *= 0.699999988079071D; this.motionZ *= 0.699999988079071D; } Material material = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)).getMaterial(); if (material.isLiquid() || material.isSolid()) { double d0 = (double)((float)(MathHelper.floor_double(this.posY) + 1) - BlockLiquid.getLiquidHeightPercent(this.worldObj.getBlockMetadata(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)))); if (this.posY < d0) { this.setDead(); } } } }