mirror of
https://github.com/PaperMC/Paper.git
synced 2025-07-26 01:32:02 -07:00
Extend block drop capture to capture all items added to the world
This commit is contained in:
@@ -110,9 +110,9 @@
|
||||
+ this.player.connection.send(tileentity.getUpdatePacket());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
return;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, pos, direction, this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND);
|
||||
+ if (event.isCancelled()) {
|
||||
@@ -123,10 +123,10 @@
|
||||
+ if (tileentity != null) {
|
||||
+ this.player.connection.send(tileentity.getUpdatePacket());
|
||||
+ }
|
||||
return;
|
||||
}
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
if (this.isCreative()) {
|
||||
this.destroyAndAck(pos, sequence, "creative destroy");
|
||||
return;
|
||||
@@ -295,7 +295,7 @@
|
||||
BlockState iblockdata1 = block.playerWillDestroy(this.level, pos, iblockdata, this.player);
|
||||
boolean flag = this.level.removeBlock(pos, false);
|
||||
|
||||
@@ -263,19 +421,32 @@
|
||||
@@ -263,19 +421,34 @@
|
||||
}
|
||||
|
||||
if (this.isCreative()) {
|
||||
@@ -316,10 +316,12 @@
|
||||
+ // return true; // CraftBukkit
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ java.util.List<net.minecraft.world.entity.item.ItemEntity> itemsToDrop = this.level.captureDrops; // Paper - capture all item additions to the world
|
||||
+ this.level.captureDrops = null; // Paper - capture all item additions to the world; Remove this earlier so that we can actually drop stuff
|
||||
+ if (event.isDropItems()) {
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, this.level.captureDrops);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, itemsToDrop); // Paper - capture all item additions to the world
|
||||
+ }
|
||||
+ this.level.captureDrops = null;
|
||||
+ //this.level.captureDrops = null; // Paper - capture all item additions to the world; move up
|
||||
+
|
||||
+ // Drop event experience
|
||||
+ if (flag && event != null) {
|
||||
@@ -331,7 +333,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -321,15 +492,58 @@
|
||||
@@ -321,15 +494,58 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,7 +392,7 @@
|
||||
if (itileinventory != null) {
|
||||
player.openMenu(itileinventory);
|
||||
return InteractionResult.CONSUME;
|
||||
@@ -359,7 +573,7 @@
|
||||
@@ -359,7 +575,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user