mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 13:07:06 +01:00
Get the BlockState before changing the block. Fixes BUKKIT-3441
This commit is contained in:
parent
98aea835b5
commit
ccbd3d84e8
1 changed files with 4 additions and 2 deletions
|
@ -77,12 +77,14 @@ public class ItemBlock extends Item {
|
|||
|
||||
// CraftBukkit start - add method to process block placement
|
||||
static boolean processBlockPlace(final World world, final EntityHuman entityhuman, final ItemStack itemstack, final int x, final int y, final int z, final int id, final int data) {
|
||||
org.bukkit.block.BlockState blockstate = org.bukkit.craftbukkit.block.CraftBlockState.getBlockState(world, x, y, z);
|
||||
|
||||
world.suppressPhysics = true;
|
||||
world.setTypeIdAndData(x, y, z, id, data);
|
||||
|
||||
org.bukkit.event.block.BlockPlaceEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(world, entityhuman, org.bukkit.craftbukkit.block.CraftBlockState.getBlockState(world, x, y, z), x, y, z);
|
||||
org.bukkit.event.block.BlockPlaceEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockstate, x, y, z);
|
||||
if (event.isCancelled() || !event.canBuild()) {
|
||||
event.getBlockReplacedState().update(true);
|
||||
blockstate.update(true);
|
||||
world.suppressPhysics = false;
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue