Java Code Examples for net.minecraft.world.World#addImportantParticle()

The following examples show how to use net.minecraft.world.World#addImportantParticle() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: the-hallow   File: WitchWaterBubbleColumnBlock.java    License: MIT License 6 votes vote down vote up
@Override
@Environment(EnvType.CLIENT)
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random rand) {
	double x = pos.getX();
	double y = pos.getY();
	double z = pos.getZ();
	if (state.get(DRAG)) {
		world.addImportantParticle(ParticleTypes.CURRENT_DOWN, x + 0.5D, y + 0.8D, z, 0.0D, 0.0D, 0.0D);
		if (rand.nextInt(200) == 0) {
			world.playSound(x, y, z, SoundEvents.BLOCK_BUBBLE_COLUMN_WHIRLPOOL_AMBIENT, SoundCategory.BLOCKS, 0.2F + rand.nextFloat() * 0.2F, 0.9F + rand.nextFloat() * 0.15F, false);
		}
	} else {
		world.addImportantParticle(ParticleTypes.BUBBLE_COLUMN_UP, x + 0.5D, y, z + 0.5D, 0.0D, 0.04D, 0.0D);
		world.addImportantParticle(ParticleTypes.BUBBLE_COLUMN_UP, x + (double) rand.nextFloat(), y + (double) rand.nextFloat(), z + (double) rand.nextFloat(), 0.0D, 0.04D, 0.0D);
		if (rand.nextInt(200) == 0) {
			world.playSound(x, y, z, SoundEvents.BLOCK_BUBBLE_COLUMN_UPWARDS_AMBIENT, SoundCategory.BLOCKS, 0.2F + rand.nextFloat() * 0.2F, 0.9F + rand.nextFloat() * 0.15F, false);
		}
	}
}
 
Example 2
Source Project: Galacticraft-Rewoven   File: VaporSpoutBlock.java    License: MIT License 4 votes vote down vote up
public void spawnSmokeParticle(World world_1, BlockPos blockPos_1) {
    Random random_1 = world_1.getRandom();
    world_1.addImportantParticle(ParticleTypes.CAMPFIRE_COSY_SMOKE, true, (double) blockPos_1.getX() + 0.5D + random_1.nextDouble() / 3.0D * (double) (random_1.nextBoolean() ? 1 : -1), (double) blockPos_1.getY() + random_1.nextDouble() + random_1.nextDouble(), (double) blockPos_1.getZ() + 0.5D + random_1.nextDouble() / 3.0D * (double) (random_1.nextBoolean() ? 1 : -1), 0.0D, 0.07D, 0.0D);
}