From 932698a237ab29263d24c56fbd3ffae0402471f7 Mon Sep 17 00:00:00 2001 From: CorranEveryone <81649947+CorranEveryone@users.noreply.github.com> Date: Wed, 25 Feb 2026 09:32:03 -1000 Subject: [PATCH 1/3] Prevent items from swapping in inventories when the slot to move the same items to already has a max stack --- src/inventory.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/inventory.rs b/src/inventory.rs index b1e46cd..ef25474 100644 --- a/src/inventory.rs +++ b/src/inventory.rs @@ -208,8 +208,10 @@ impl Inventory { ), ); } else { - other_inventory.replace_slot_item_stack(end_slot, start_slot_itemstack); - self.replace_slot_item_stack(start_slot, end_slot_itemstack); + if end_slot_itemstack.amount as usize != end_max_stack_amount { + other_inventory.replace_slot_item_stack(end_slot, start_slot_itemstack); + self.replace_slot_item_stack(start_slot, end_slot_itemstack); + } } } } @@ -366,7 +368,9 @@ impl Inventory { ), ); } else { - self.swap_slots(start_slot, end_slot); + if end_slot_itemstack.amount as usize != end_max_stack_amount { + self.swap_slots(start_slot, end_slot); + } } } } From a820f15fdf6058eb3f52c753acdf59fae50f7260 Mon Sep 17 00:00:00 2001 From: CorranEveryone <81649947+CorranEveryone@users.noreply.github.com> Date: Wed, 25 Feb 2026 09:40:15 -1000 Subject: [PATCH 2/3] Fixed not being able to move items to empty slots unless it was from the creative inventory or splitting stacks --- src/inventory.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/inventory.rs b/src/inventory.rs index ef25474..ac8aa3e 100644 --- a/src/inventory.rs +++ b/src/inventory.rs @@ -208,7 +208,9 @@ impl Inventory { ), ); } else { - if end_slot_itemstack.amount as usize != end_max_stack_amount { + if end_slot_itemstack.amount as usize != end_max_stack_amount + && end_slot_itemstack.item_type == ItemType::Air + { other_inventory.replace_slot_item_stack(end_slot, start_slot_itemstack); self.replace_slot_item_stack(start_slot, end_slot_itemstack); } @@ -368,7 +370,9 @@ impl Inventory { ), ); } else { - if end_slot_itemstack.amount as usize != end_max_stack_amount { + if end_slot_itemstack.amount as usize != end_max_stack_amount + && end_slot_itemstack.item_type == ItemType::Air + { self.swap_slots(start_slot, end_slot); } } From 08774cfa503680c6cf81c64072234643a3a082fd Mon Sep 17 00:00:00 2001 From: CorranEveryone <81649947+CorranEveryone@users.noreply.github.com> Date: Wed, 25 Feb 2026 09:58:29 -1000 Subject: [PATCH 3/3] Replace the if x and y statement I made with an if x or y statement to fix the last change I made --- src/inventory.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/inventory.rs b/src/inventory.rs index ac8aa3e..f5dd915 100644 --- a/src/inventory.rs +++ b/src/inventory.rs @@ -209,7 +209,7 @@ impl Inventory { ); } else { if end_slot_itemstack.amount as usize != end_max_stack_amount - && end_slot_itemstack.item_type == ItemType::Air + || end_slot_itemstack.item_type == ItemType::Air { other_inventory.replace_slot_item_stack(end_slot, start_slot_itemstack); self.replace_slot_item_stack(start_slot, end_slot_itemstack); @@ -371,7 +371,7 @@ impl Inventory { ); } else { if end_slot_itemstack.amount as usize != end_max_stack_amount - && end_slot_itemstack.item_type == ItemType::Air + || end_slot_itemstack.item_type == ItemType::Air { self.swap_slots(start_slot, end_slot); }