--- a/net/minecraft/world/level/block/BlockConcretePowder.java +++ b/net/minecraft/world/level/block/BlockConcretePowder.java @@ -13,6 +13,11 @@ import net.minecraft.world.level.block.state.BlockBase; import net.minecraft.world.level.block.state.IBlockData; +// CraftBukkit start +import org.bukkit.craftbukkit.block.CraftBlockState; +import org.bukkit.event.block.BlockFormEvent; +// CraftBukkit end + public class BlockConcretePowder extends BlockFalling { private final IBlockData concrete; @@ -25,7 +30,7 @@ @Override public void a(World world, BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1, EntityFallingBlock entityfallingblock) { if (canHarden(world, blockposition, iblockdata1)) { - world.setTypeAndData(blockposition, this.concrete, 3); + org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, this.concrete, 3); // CraftBukkit } } @@ -36,7 +41,24 @@ BlockPosition blockposition = blockactioncontext.getClickPosition(); IBlockData iblockdata = world.getType(blockposition); - return canHarden(world, blockposition, iblockdata) ? this.concrete : super.getPlacedState(blockactioncontext); + // CraftBukkit start + if (!canHarden(world, blockposition, iblockdata)) { + return super.getPlacedState(blockactioncontext); + } + + // TODO: An event factory call for methods like this + CraftBlockState blockState = CraftBlockState.getBlockState(world, blockposition); + blockState.setData(this.concrete); + + BlockFormEvent event = new BlockFormEvent(blockState.getBlock(), blockState); + world.getMinecraftServer().server.getPluginManager().callEvent(event); + + if (!event.isCancelled()) { + return blockState.getHandle(); + } + + return super.getPlacedState(blockactioncontext); + // CraftBukkit end } private static boolean canHarden(IBlockAccess iblockaccess, BlockPosition blockposition, IBlockData iblockdata) { @@ -72,7 +94,25 @@ @Override public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) { - return a((IBlockAccess) generatoraccess, blockposition) ? this.concrete : super.updateState(iblockdata, enumdirection, iblockdata1, generatoraccess, blockposition, blockposition1); + // CraftBukkit start + if (a((IBlockAccess) generatoraccess, blockposition)) { + // Suppress during worldgen + if (!(generatoraccess instanceof World)) { + return this.concrete; + } + CraftBlockState blockState = CraftBlockState.getBlockState(generatoraccess, blockposition); + blockState.setData(this.concrete); + + BlockFormEvent event = new BlockFormEvent(blockState.getBlock(), blockState); + ((World) generatoraccess).getCraftServer().getPluginManager().callEvent(event); + + if (!event.isCancelled()) { + return blockState.getHandle(); + } + } + + return super.updateState(iblockdata, enumdirection, iblockdata1, generatoraccess, blockposition, blockposition1); + // CraftBukkit end } @Override