use of forestry.core.entities.ParticleColoredDripParticle in project ForestryMC by ForestryMC.
the class BlockForestryFluid method randomDisplayTick.
/**
* Copied from {@link BlockLiquid#randomDisplayTick(IBlockState, World, BlockPos, Random)}
* and modified to have colored particles.
*/
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) {
double d0 = pos.getX();
double d1 = pos.getY();
double d2 = pos.getZ();
if (this.blockMaterial == Material.WATER) {
int i = stateIn.getValue(LEVEL);
if (i > 0 && i < 8) {
if (getFluid().getViscosity(worldIn, pos) < 5000 && rand.nextInt(64) == 0) {
worldIn.playSound(d0 + 0.5D, d1 + 0.5D, d2 + 0.5D, SoundEvents.BLOCK_WATER_AMBIENT, SoundCategory.BLOCKS, rand.nextFloat() * 0.25F + 0.75F, rand.nextFloat() + 0.5F, false);
}
} else if (rand.nextInt(10) == 0) {
worldIn.spawnParticle(EnumParticleTypes.SUSPENDED, d0 + rand.nextFloat(), d1 + rand.nextFloat(), d2 + rand.nextFloat(), 0.0D, 0.0D, 0.0D);
}
}
if (this.blockMaterial == Material.LAVA && worldIn.getBlockState(pos.up()).getMaterial() == Material.AIR && !worldIn.getBlockState(pos.up()).isOpaqueCube()) {
if (rand.nextInt(100) == 0) {
double d8 = d0 + rand.nextFloat();
double d4 = d1 + stateIn.getBoundingBox(worldIn, pos).maxY;
double d6 = d2 + rand.nextFloat();
worldIn.spawnParticle(EnumParticleTypes.LAVA, d8, d4, d6, 0.0D, 0.0D, 0.0D);
worldIn.playSound(d8, d4, d6, SoundEvents.BLOCK_LAVA_POP, SoundCategory.BLOCKS, 0.2F + rand.nextFloat() * 0.2F, 0.9F + rand.nextFloat() * 0.15F, false);
}
if (rand.nextInt(200) == 0) {
worldIn.playSound(d0, d1, d2, SoundEvents.BLOCK_LAVA_AMBIENT, SoundCategory.BLOCKS, 0.2F + rand.nextFloat() * 0.2F, 0.9F + rand.nextFloat() * 0.15F, false);
}
}
if (rand.nextInt(10) == 0 && worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos.down(), EnumFacing.DOWN)) {
Material material = worldIn.getBlockState(pos.down(2)).getMaterial();
if (!material.blocksMovement() && !material.isLiquid()) {
double px = d0 + rand.nextFloat();
double py = d1 - 1.05D;
double pz = d2 + rand.nextFloat();
Particle fx = new ParticleColoredDripParticle(worldIn, px, py, pz, color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f);
FMLClientHandler.instance().getClient().effectRenderer.addEffect(fx);
}
}
}
Aggregations