|
16 | 16 | } |
17 | 17 | // CraftBukkit end |
18 | 18 | // Paper start - Don't suggest if tab-complete is disabled |
| 19 | +@@ -977,7 +_,8 @@ |
| 20 | + addBlockDataToItem(blockState, serverLevel, blockPos, cloneItemStack); |
| 21 | + } |
| 22 | + |
| 23 | +- this.tryPickItem(cloneItemStack); |
| 24 | ++ Location location = new Location(this.player.getBukkitEntity().getWorld(), blockPos.getX(), blockPos.getY(), blockPos.getZ()); |
| 25 | ++ this.tryPickItem(cloneItemStack, location, null); |
| 26 | + } |
| 27 | + } |
| 28 | + } |
| 29 | +@@ -1001,12 +_,12 @@ |
| 30 | + if (entity != null && this.player.canInteractWithEntity(entity, 3.0)) { |
| 31 | + ItemStack pickResult = entity.getPickResult(); |
| 32 | + if (pickResult != null && !pickResult.isEmpty()) { |
| 33 | +- this.tryPickItem(pickResult); |
| 34 | ++ this.tryPickItem(pickResult, null, entity.getBukkitEntity()); |
| 35 | + } |
| 36 | + } |
| 37 | + } |
| 38 | + |
| 39 | +- private void tryPickItem(ItemStack stack) { |
| 40 | ++ private void tryPickItem(ItemStack stack, Location location, org.bukkit.entity.Entity entity) { |
| 41 | + if (stack.isItemEnabled(this.player.level().enabledFeatures())) { |
| 42 | + Inventory inventory = this.player.getInventory(); |
| 43 | + int i = inventory.findSlotMatchingItem(stack); |
| 44 | +@@ -1014,7 +_,7 @@ |
| 45 | + final int sourceSlot = i; |
| 46 | + final int targetSlot = Inventory.isHotbarSlot(sourceSlot) ? sourceSlot : inventory.getSuitableHotbarSlot(); |
| 47 | + final org.bukkit.entity.Player bukkitPlayer = this.player.getBukkitEntity(); |
| 48 | +- final io.papermc.paper.event.player.PlayerPickItemEvent event = new io.papermc.paper.event.player.PlayerPickItemEvent(bukkitPlayer, targetSlot, sourceSlot); |
| 49 | ++ final io.papermc.paper.event.player.PlayerPickItemEvent event = new io.papermc.paper.event.player.PlayerPickItemEvent(bukkitPlayer, targetSlot, sourceSlot, location, entity); |
| 50 | + if (!event.callEvent()) { |
| 51 | + return; |
| 52 | + } |
19 | 53 | @@ -2497,6 +_,7 @@ |
20 | 54 |
|
21 | 55 | // Spigot start - spam exclusions |
|
0 commit comments