Later to be added as incense block
This commit is contained in:
@@ -3,11 +3,17 @@ package com.acethewildfire.acesbs.block.custom;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.particle.SimpleParticleType;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EvilBlock extends Block {
|
||||
@@ -31,4 +37,31 @@ public class EvilBlock extends Block {
|
||||
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
|
||||
builder.add(CLICKED);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasRandomTicks(BlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) {
|
||||
spawnSmokeParticle(world, pos, true, true);
|
||||
}
|
||||
|
||||
public static void spawnSmokeParticle(World world, BlockPos pos, boolean isSignal, boolean lotsOfSmoke) {
|
||||
Random random = world.getRandom();
|
||||
SimpleParticleType simpleParticleType = isSignal ? ParticleTypes.CAMPFIRE_SIGNAL_SMOKE : ParticleTypes.CAMPFIRE_COSY_SMOKE;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
world.addImportantParticleClient(simpleParticleType, true,
|
||||
(double)pos.getX() + (double)0.5F + (random.nextDouble() * 30) / (double)3.0F * (double)(random.nextBoolean() ? 1 : -1),
|
||||
(double)pos.getY() - random.nextDouble(),
|
||||
(double)pos.getZ() + (double)0.5F + (random.nextDouble() * 30) / (double)3.0F * (double)(random.nextBoolean() ? 1 : -1),
|
||||
(double)0.0F, -0.03, (double)0.0F);
|
||||
}
|
||||
|
||||
if (lotsOfSmoke) {
|
||||
world.addParticleClient(ParticleTypes.SMOKE, (double)pos.getX() + (double)0.5F + random.nextDouble() / (double)4.0F * (double)(random.nextBoolean() ? 1 : -1), (double)pos.getY() + 0.4, (double)pos.getZ() + (double)0.5F + random.nextDouble() / (double)4.0F * (double)(random.nextBoolean() ? 1 : -1), (double)0.0F, 0.005, (double)0.0F);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user