From 8797975de5f4fa94283363645e118005c6d1ce93 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sat, 12 Jun 2021 15:23:44 +1000 Subject: [PATCH] SPIGOT-6513: Placing ItemStack in Inventory causes InventoryAction.NOTHING By: md_5 --- .../server/network/PlayerConnection.patch | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/paper-server/nms-patches/net/minecraft/server/network/PlayerConnection.patch b/paper-server/nms-patches/net/minecraft/server/network/PlayerConnection.patch index 8df42d3b35..bfc66b4f67 100644 --- a/paper-server/nms-patches/net/minecraft/server/network/PlayerConnection.patch +++ b/paper-server/nms-patches/net/minecraft/server/network/PlayerConnection.patch @@ -1265,7 +1265,7 @@ + if (packetplayinwindowclick.d() == 0 || packetplayinwindowclick.d() == 1) { + action = InventoryAction.NOTHING; // Don't want to repeat ourselves + if (packetplayinwindowclick.c() == -999) { -+ if (!player.inventoryMenu.getCarried().isEmpty()) { ++ if (!player.containerMenu.getCarried().isEmpty()) { + action = packetplayinwindowclick.d() == 0 ? InventoryAction.DROP_ALL_CURSOR : InventoryAction.DROP_ONE_CURSOR; + } + } else if (packetplayinwindowclick.c() < 0) { @@ -1274,7 +1274,7 @@ + Slot slot = this.player.containerMenu.getSlot(packetplayinwindowclick.c()); + if (slot != null) { + ItemStack clickedItem = slot.getItem(); -+ ItemStack cursor = player.inventoryMenu.getCarried(); ++ ItemStack cursor = player.containerMenu.getCarried(); + if (clickedItem.isEmpty()) { + if (!cursor.isEmpty()) { + action = packetplayinwindowclick.d() == 0 ? InventoryAction.PLACE_ALL : InventoryAction.PLACE_ONE; @@ -1362,7 +1362,7 @@ + action = InventoryAction.NOTHING; + } else { + Slot slot = this.player.containerMenu.getSlot(packetplayinwindowclick.c()); -+ if (slot != null && slot.hasItem() && player.getAbilities().instabuild && player.inventoryMenu.getCarried().isEmpty()) { ++ if (slot != null && slot.hasItem() && player.getAbilities().instabuild && player.containerMenu.getCarried().isEmpty()) { + action = InventoryAction.CLONE_STACK; + } else { + action = InventoryAction.NOTHING; @@ -1407,8 +1407,8 @@ + case PICKUP_ALL: + click = ClickType.DOUBLE_CLICK; + action = InventoryAction.NOTHING; -+ if (packetplayinwindowclick.c() >= 0 && !this.player.inventoryMenu.getCarried().isEmpty()) { -+ ItemStack cursor = this.player.inventoryMenu.getCarried(); ++ if (packetplayinwindowclick.c() >= 0 && !this.player.containerMenu.getCarried().isEmpty()) { ++ ItemStack cursor = this.player.containerMenu.getCarried(); + action = InventoryAction.NOTHING; + // Quick check for if we have any of the item + if (inventory.getTopInventory().contains(CraftMagicNumbers.getMaterial(cursor.getItem())) || inventory.getBottomInventory().contains(CraftMagicNumbers.getMaterial(cursor.getItem()))) { @@ -1492,7 +1492,7 @@ + case PLACE_SOME: + case PLACE_ONE: + case SWAP_WITH_CURSOR: -+ this.player.connection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.player.inventoryMenu.getCarried())); ++ this.player.connection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.player.containerMenu.getCarried())); + this.player.connection.sendPacket(new PacketPlayOutSetSlot(this.player.containerMenu.containerId, packetplayinwindowclick.c(), this.player.containerMenu.getSlot(packetplayinwindowclick.c()).getItem())); + break; + // Modified clicked only @@ -1504,7 +1504,7 @@ + case DROP_ALL_CURSOR: + case DROP_ONE_CURSOR: + case CLONE_STACK: -+ this.player.connection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.player.inventoryMenu.getCarried())); ++ this.player.connection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.player.containerMenu.getCarried())); + break; + // Nothing + case NOTHING: