Properly handle BlockBreakEvent#isDropItems

Setting whether a block break dropped items controlled
far more than just whether blocks dropped, like stat increases
food consumption, turtle egg count decreases, ice to water
conversions and beehive releases
This commit is contained in:
Jake Potrebic
2023-03-04 10:52:52 -08:00
parent 0f4ee39a8e
commit 597cb633e8
7 changed files with 107 additions and 16 deletions

View File

@@ -337,8 +337,9 @@
itemstack.mineBlock(this.level, iblockdata1, pos, this.player);
- if (flag && flag1) {
+ if (flag && flag1 && event.isDropItems()) { // CraftBukkit - Check if block should drop items
block.playerDestroy(this.level, this.player, pos, iblockdata1, tileentity, itemstack1);
- block.playerDestroy(this.level, this.player, pos, iblockdata1, tileentity, itemstack1);
+ if (flag && flag1/* && event.isDropItems() */) { // CraftBukkit - Check if block should drop items // Paper - fix drops not preventing stats/food exhaustion
+ block.playerDestroy(this.level, this.player, pos, iblockdata1, tileentity, itemstack1, event.isDropItems(), false); // Paper - fix drops not preventing stats/food exhaustion
}
- return true;