From 8676c7297fed43538dfc1f98f8518e8797c7f898 Mon Sep 17 00:00:00 2001 From: CuzImClicks <58398364+CuzImClicks@users.noreply.github.com> Date: Wed, 30 Oct 2024 21:55:28 +0100 Subject: [PATCH] fix overflowing into offhand, hotbar, armor and 2x2 --- crates/hyperion-inventory/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/hyperion-inventory/src/lib.rs b/crates/hyperion-inventory/src/lib.rs index e5a899a6..f7bb0648 100644 --- a/crates/hyperion-inventory/src/lib.rs +++ b/crates/hyperion-inventory/src/lib.rs @@ -295,9 +295,9 @@ impl PlayerInventory { pub fn try_add_item(&mut self, mut item: ItemStack) -> AddItemResult { let mut result = AddItemResult { remaining: None }; - // Try to add to hand slots (36-45) first, then the rest of the inventory (0-35) + // Try to add to hot bar (36-45) first, then the rest of the inventory (9-35) // try to stack first - for slot in (36..=45).chain(0..36) { + for slot in (36..=44).chain(9..36) { let Ok(add_slot) = self.try_add_to_slot(slot, &mut item, false) else { unreachable!("try_add_item should always return Ok"); }; @@ -310,9 +310,9 @@ impl PlayerInventory { } } - // Try to add to hand slots (36-45) first, then the rest of the inventory (0-35) + // Try to add to hot bar (36-44) first, then the rest of the inventory (9-35) // now try to add to empty slots - for slot in (36..=45).chain(0..36) { + for slot in (36..=44).chain(9..36) { let Ok(add_slot) = self.try_add_to_slot(slot, &mut item, true) else { unreachable!("try_add_item should always return Ok"); };