diff options
author | Jake Potrebic <[email protected]> | 2024-05-29 14:56:14 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2024-05-29 14:56:14 -0700 |
commit | 0fcf3e347f671ce6bdc9699cbe4c34567562dd2b (patch) | |
tree | 16151fd775fe30a88cddfc613d199009644bb96c | |
parent | 27d2ed84f43e7637e85f15d880fbad022038413e (diff) | |
download | Paper-0fcf3e347f671ce6bdc9699cbe4c34567562dd2b.tar.gz Paper-0fcf3e347f671ce6bdc9699cbe4c34567562dd2b.zip |
Deprecate InvAction#HOTBAR_MOVE_AND_READD (#10784)
-rw-r--r-- | patches/api/0483-Deprecate-InvAction-HOTBAR_MOVE_AND_READD.patch | 20 | ||||
-rw-r--r-- | patches/server/1051-Deprecate-InvAction-HOTBAR_MOVE_AND_READD.patch | 26 |
2 files changed, 46 insertions, 0 deletions
diff --git a/patches/api/0483-Deprecate-InvAction-HOTBAR_MOVE_AND_READD.patch b/patches/api/0483-Deprecate-InvAction-HOTBAR_MOVE_AND_READD.patch new file mode 100644 index 0000000000..3efcc02654 --- /dev/null +++ b/patches/api/0483-Deprecate-InvAction-HOTBAR_MOVE_AND_READD.patch @@ -0,0 +1,20 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic <[email protected]> +Date: Sat, 25 May 2024 09:51:07 -0700 +Subject: [PATCH] Deprecate InvAction#HOTBAR_MOVE_AND_READD + + +diff --git a/src/main/java/org/bukkit/event/inventory/InventoryAction.java b/src/main/java/org/bukkit/event/inventory/InventoryAction.java +index e914873f39cb22b87d44d772953cade28df192e2..b2bcc891196d487cf4c1962b51ec439e921f49f6 100644 +--- a/src/main/java/org/bukkit/event/inventory/InventoryAction.java ++++ b/src/main/java/org/bukkit/event/inventory/InventoryAction.java +@@ -70,7 +70,9 @@ public enum InventoryAction { + * is re-added to the player's inventory. + * + * The hotbar includes the player's off hand. ++ * @deprecated This action no longer happens, they are all {@link #HOTBAR_SWAP}s. + */ ++ @Deprecated(since = "1.20.6") // Paper + HOTBAR_MOVE_AND_READD, + /** + * The clicked slot and the picked hotbar slot are swapped. diff --git a/patches/server/1051-Deprecate-InvAction-HOTBAR_MOVE_AND_READD.patch b/patches/server/1051-Deprecate-InvAction-HOTBAR_MOVE_AND_READD.patch new file mode 100644 index 0000000000..6be68ca368 --- /dev/null +++ b/patches/server/1051-Deprecate-InvAction-HOTBAR_MOVE_AND_READD.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic <[email protected]> +Date: Sat, 25 May 2024 09:51:13 -0700 +Subject: [PATCH] Deprecate InvAction#HOTBAR_MOVE_AND_READD + + +diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index c450447585af4c8cdc87abe871c229ff895c3e53..4ae88bfcead40cd05f9514a48a922a37767cb3cf 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -3054,14 +3054,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl + Slot clickedSlot = this.player.containerMenu.getSlot(packet.getSlotNum()); + if (clickedSlot.mayPickup(this.player)) { + ItemStack hotbar = this.player.getInventory().getItem(packet.getButtonNum()); +- boolean canCleanSwap = hotbar.isEmpty() || (clickedSlot.container == this.player.getInventory() && clickedSlot.mayPlace(hotbar)); // the slot will accept the hotbar item +- if (clickedSlot.hasItem()) { +- if (canCleanSwap) { +- action = InventoryAction.HOTBAR_SWAP; +- } else { +- action = InventoryAction.HOTBAR_MOVE_AND_READD; +- } +- } else if (!clickedSlot.hasItem() && !hotbar.isEmpty() && clickedSlot.mayPlace(hotbar)) { ++ if ((!hotbar.isEmpty() && clickedSlot.mayPlace(hotbar)) || (hotbar.isEmpty() && clickedSlot.hasItem())) { // Paper - modernify this logic (no such thing as a "hotbar move and readd" + action = InventoryAction.HOTBAR_SWAP; + } else { + action = InventoryAction.NOTHING; |