diff --git a/parchment-api/paper-patches/files/src/main/java/io/papermc/paper/event/player/PlayerPickItemEvent.java.patch b/parchment-api/paper-patches/files/src/main/java/io/papermc/paper/event/player/PlayerPickItemEvent.java.patch index 7d7eac3..e9d3093 100644 --- a/parchment-api/paper-patches/files/src/main/java/io/papermc/paper/event/player/PlayerPickItemEvent.java.patch +++ b/parchment-api/paper-patches/files/src/main/java/io/papermc/paper/event/player/PlayerPickItemEvent.java.patch @@ -9,27 +9,30 @@ import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; -@@ -22,13 +_,18 @@ +@@ -21,14 +_,21 @@ + private int targetSlot; private int sourceSlot; - -+ private Location location; -+ private Entity entity; ++ private final Location location; ++ private final Entity entity; ++ private boolean isRequestingData; + + private boolean cancelled; @ApiStatus.Internal - public PlayerPickItemEvent(final Player player, final int targetSlot, final int sourceSlot) { -+ public PlayerPickItemEvent(final Player player, final int targetSlot, final int sourceSlot, final Location location, final Entity entity) { ++ public PlayerPickItemEvent(final Player player, final int targetSlot, final int sourceSlot, final Location location, final Entity entity, boolean isRequestingData) { super(player); this.targetSlot = targetSlot; this.sourceSlot = sourceSlot; + this.location = location; + this.entity = entity; ++ this.isRequestingData = isRequestingData; } /** -@@ -72,6 +_,14 @@ +@@ -72,6 +_,18 @@ public void setSourceSlot(final @Range(from = -1, to = 35) int sourceSlot) { Preconditions.checkArgument(sourceSlot >= -1 && sourceSlot <= 35, "Source slot must be in range of the player's inventory slot, or -1"); this.sourceSlot = sourceSlot; @@ -41,6 +44,10 @@ + + public @org.jetbrains.annotations.Nullable Entity getEntity() { + return entity; ++ } ++ ++ public boolean isRequestingData() { ++ return isRequestingData; } @Override diff --git a/parchment-server/minecraft-patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch b/parchment-server/minecraft-patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch index c99efb7..142bae8 100644 --- a/parchment-server/minecraft-patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch +++ b/parchment-server/minecraft-patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch @@ -22,7 +22,7 @@ - this.tryPickItem(cloneItemStack); + Location location = new Location(this.player.getBukkitEntity().getWorld(), blockPos.getX(), blockPos.getY(), blockPos.getZ()); -+ this.tryPickItem(cloneItemStack, location, null); ++ this.tryPickItem(cloneItemStack, location, null, flag); } } } @@ -31,13 +31,13 @@ ItemStack pickResult = entity.getPickResult(); if (pickResult != null && !pickResult.isEmpty()) { - this.tryPickItem(pickResult); -+ this.tryPickItem(pickResult, null, entity.getBukkitEntity()); ++ this.tryPickItem(pickResult, null, entity.getBukkitEntity(), this.player.hasInfiniteMaterials() && packet.includeData()); } } } - private void tryPickItem(ItemStack stack) { -+ private void tryPickItem(ItemStack stack, Location location, org.bukkit.entity.Entity entity) { ++ private void tryPickItem(ItemStack stack, Location location, org.bukkit.entity.Entity entity, boolean isRequestingData) { if (stack.isItemEnabled(this.player.level().enabledFeatures())) { Inventory inventory = this.player.getInventory(); int i = inventory.findSlotMatchingItem(stack); @@ -46,7 +46,7 @@ final int targetSlot = Inventory.isHotbarSlot(sourceSlot) ? sourceSlot : inventory.getSuitableHotbarSlot(); final org.bukkit.entity.Player bukkitPlayer = this.player.getBukkitEntity(); - final io.papermc.paper.event.player.PlayerPickItemEvent event = new io.papermc.paper.event.player.PlayerPickItemEvent(bukkitPlayer, targetSlot, sourceSlot); -+ final io.papermc.paper.event.player.PlayerPickItemEvent event = new io.papermc.paper.event.player.PlayerPickItemEvent(bukkitPlayer, targetSlot, sourceSlot, location, entity); ++ final io.papermc.paper.event.player.PlayerPickItemEvent event = new io.papermc.paper.event.player.PlayerPickItemEvent(bukkitPlayer, targetSlot, sourceSlot, location, entity, isRequestingData); if (!event.callEvent()) { return; }