aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0959-Deprecate-InvAction-HOTBAR_MOVE_AND_READD.patch
blob: a64cff1780be54973e72e15af07fe178d0983cd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
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 ed4b69bc1875f1d90b02166d62078137c41e07a5..401f4a071847cb987dbff3ae0e989d3a04fd9a7d 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3090,14 +3090,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;