From 416d1e8c6030db793534fcd1fa697c29b3552e81 Mon Sep 17 00:00:00 2001 From: levi Date: Sun, 23 Aug 2026 13:39:38 +0200 Subject: [PATCH] Add explicit check if we are swapping from and to the same slot We had unexpected behavior when swapping to the same hot bar slot. As this shouldn't ever swap anyhow as they are the same slot. An explicit check has been added for it. This also seems to lead to the items not being deleted from your inventory. --- .../java/com/cleanroommc/modularui/screen/ModularContainer.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/cleanroommc/modularui/screen/ModularContainer.java b/src/main/java/com/cleanroommc/modularui/screen/ModularContainer.java index 2a29216aa..7fbe7052c 100644 --- a/src/main/java/com/cleanroommc/modularui/screen/ModularContainer.java +++ b/src/main/java/com/cleanroommc/modularui/screen/ModularContainer.java @@ -366,6 +366,7 @@ public ItemStack slotClick(int slotId, int mouseButton, int mode, EntityPlayer p Slot fromSlot = getSlot(slotId); ItemStack fromItem = fromSlot.getStack(); ItemStack hotbarStack = hotbarSlot.getStack(); + if (hotbarSlot == fromSlot) return null; if (fromItem != null && !hotbarSlot.isItemValid(fromItem)) return null; if (hotbarStack != null && !hotbarSlot.canTakeStack(player)) return null; }