summaryrefslogtreecommitdiffstats
path: root/nms-patches
diff options
context:
space:
mode:
authorScetra <contact@scetra.me>2017-05-27 21:16:13 -0400
committermd_5 <git@md-5.net>2017-05-28 17:08:28 +1000
commitccc420a95706d3fca88e8f6ea11fed76a3d6bad3 (patch)
treea88ca75055d08577c6b192e8366e0fa48b3007a2 /nms-patches
parentc037fe3d442702885d9c6bfa65621fb624210c02 (diff)
downloadcraftbukkit-ccc420a95706d3fca88e8f6ea11fed76a3d6bad3.tar
craftbukkit-ccc420a95706d3fca88e8f6ea11fed76a3d6bad3.tar.gz
craftbukkit-ccc420a95706d3fca88e8f6ea11fed76a3d6bad3.tar.lz
craftbukkit-ccc420a95706d3fca88e8f6ea11fed76a3d6bad3.tar.xz
craftbukkit-ccc420a95706d3fca88e8f6ea11fed76a3d6bad3.zip
Add support for preventing block drops in BreakEvent
Diffstat (limited to 'nms-patches')
-rw-r--r--nms-patches/PlayerInteractManager.patch27
1 files changed, 17 insertions, 10 deletions
diff --git a/nms-patches/PlayerInteractManager.patch b/nms-patches/PlayerInteractManager.patch
index 7362bf4a..f140fbe1 100644
--- a/nms-patches/PlayerInteractManager.patch
+++ b/nms-patches/PlayerInteractManager.patch
@@ -194,14 +194,14 @@
TileEntity tileentity = this.world.getTileEntity(blockposition);
Block block = iblockdata.getBlock();
-+ // CraftBukkit start - Special case skulls, their item data comes from a tile entity
-+ if (iblockdata.getBlock() == Blocks.SKULL && !this.isCreative()) {
++ // CraftBukkit start - Special case skulls, their item data comes from a tile entity (Also check if block should drop items)
++ if (iblockdata.getBlock() == Blocks.SKULL && !this.isCreative() && event.isDropItems()) {
+ iblockdata.getBlock().dropNaturally(world, blockposition, iblockdata, 1.0F, 0);
+ return this.c(blockposition);
+ }
+
-+ // And shulker boxes too for duplication on cancel reasons
-+ if (iblockdata.getBlock() instanceof BlockShulkerBox) {
++ // And shulker boxes too for duplication on cancel reasons (Also check if block should drop items)
++ if (iblockdata.getBlock() instanceof BlockShulkerBox && event.isDropItems()) {
+ iblockdata.getBlock().dropNaturally(world, blockposition, iblockdata, 1.0F, 0);
+ return this.c(blockposition);
+ }
@@ -210,20 +210,27 @@
if ((block instanceof BlockCommand || block instanceof BlockStructure) && !this.player.isCreativeAndOp()) {
this.world.notify(blockposition, iblockdata, iblockdata, 3);
return false;
-@@ -236,6 +369,12 @@
+@@ -231,10 +364,18 @@
+ itemstack1.a(this.world, iblockdata, blockposition, this.player);
}
- }
+- if (flag && flag1) {
++ // CraftBukkit start - Check if block should drop items
++ if (flag && flag1 && event.isDropItems()) {
+ iblockdata.getBlock().a(this.world, this.player, blockposition, iblockdata, tileentity, itemstack2);
+ }
++ // CraftBukkit end
++ }
++
+ // CraftBukkit start - Drop event experience
+ if (flag && event != null) {
+ iblockdata.getBlock().dropExperience(this.world, blockposition, event.getExpToDrop());
-+ }
+ }
+ // CraftBukkit end
-+
+
return flag;
}
- }
-@@ -278,63 +417,90 @@
+@@ -278,63 +419,90 @@
}
}