summaryrefslogtreecommitdiffstats
path: root/nms-patches
diff options
context:
space:
mode:
authorThinkofdeath <thinkofdeath@spigotmc.org>2016-03-01 21:37:08 +0000
committerThinkofdeath <thinkofdeath@spigotmc.org>2016-03-01 21:37:08 +0000
commit1be3bd058faf4fc0f2a351e92a99786e53f770b9 (patch)
tree7cf59d52b00b57e97bbdc68ebe947ce9ef9e3c95 /nms-patches
parent4ca1f899071572fbd5d89fe52aeaeec1e474e920 (diff)
downloadcraftbukkit-1be3bd058faf4fc0f2a351e92a99786e53f770b9.tar
craftbukkit-1be3bd058faf4fc0f2a351e92a99786e53f770b9.tar.gz
craftbukkit-1be3bd058faf4fc0f2a351e92a99786e53f770b9.tar.lz
craftbukkit-1be3bd058faf4fc0f2a351e92a99786e53f770b9.tar.xz
craftbukkit-1be3bd058faf4fc0f2a351e92a99786e53f770b9.zip
SPIGOT-1607: Fix BlockPlaceEvent and BlockMultiPlaceEvent sometimes showing the wrong item used
Diffstat (limited to 'nms-patches')
-rw-r--r--nms-patches/ItemFlintAndSteel.patch2
-rw-r--r--nms-patches/ItemStack.patch4
-rw-r--r--nms-patches/ItemWaterLily.patch2
3 files changed, 4 insertions, 4 deletions
diff --git a/nms-patches/ItemFlintAndSteel.patch b/nms-patches/ItemFlintAndSteel.patch
index 20d31fe8..d6fa0787 100644
--- a/nms-patches/ItemFlintAndSteel.patch
+++ b/nms-patches/ItemFlintAndSteel.patch
@@ -33,7 +33,7 @@
world.setTypeAndData(blockposition, Blocks.FIRE.getBlockData(), 11);
+
+ // CraftBukkit start
-+ org.bukkit.event.block.BlockPlaceEvent placeEvent = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clicked.getX(), clicked.getY(), clicked.getZ());
++ org.bukkit.event.block.BlockPlaceEvent placeEvent = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, enumhand, blockState, clicked.getX(), clicked.getY(), clicked.getZ());
+
+ if (placeEvent.isCancelled() || !placeEvent.canBuild()) {
+ placeEvent.getBlockPlaced().setTypeIdAndData(0, (byte) 0, false);
diff --git a/nms-patches/ItemStack.patch b/nms-patches/ItemStack.patch
index 58546163..b271b49b 100644
--- a/nms-patches/ItemStack.patch
+++ b/nms-patches/ItemStack.patch
@@ -97,9 +97,9 @@
+ List<BlockState> blocks = (List<BlockState>) world.capturedBlockStates.clone();
+ world.capturedBlockStates.clear();
+ if (blocks.size() > 1) {
-+ placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockMultiPlaceEvent(world, entityhuman, blocks, blockposition.getX(), blockposition.getY(), blockposition.getZ());
++ placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockMultiPlaceEvent(world, entityhuman, enumhand, blocks, blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ } else if (blocks.size() == 1) {
-+ placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blocks.get(0), blockposition.getX(), blockposition.getY(), blockposition.getZ());
++ placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(world, entityhuman, enumhand, blocks.get(0), blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ }
+
+ if (placeEvent != null && (placeEvent.isCancelled() || !placeEvent.canBuild())) {
diff --git a/nms-patches/ItemWaterLily.patch b/nms-patches/ItemWaterLily.patch
index 18718a90..ab27cf91 100644
--- a/nms-patches/ItemWaterLily.patch
+++ b/nms-patches/ItemWaterLily.patch
@@ -7,7 +7,7 @@
+ // CraftBukkit start - special case for handling block placement with water lilies
+ org.bukkit.block.BlockState blockstate = org.bukkit.craftbukkit.block.CraftBlockState.getBlockState(world, blockposition1.getX(), blockposition1.getY(), blockposition1.getZ());
world.setTypeAndData(blockposition1, Blocks.WATERLILY.getBlockData(), 11);
-+ org.bukkit.event.block.BlockPlaceEvent placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockstate, blockposition.getX(), blockposition.getY(), blockposition.getZ());
++ org.bukkit.event.block.BlockPlaceEvent placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(world, entityhuman, enumhand, blockstate, blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ if (placeEvent != null && (placeEvent.isCancelled() || !placeEvent.canBuild())) {
+ blockstate.update(true, false);
+ return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack);