From a967ca43407d599ba898aaa1240df83e1eeb777b Mon Sep 17 00:00:00 2001 From: iLostName <55976057+iLostName@users.noreply.github.com> Date: Wed, 28 Oct 2026 06:03:42 +0100 Subject: [PATCH] item pickup: a stack in the off hand fills before the inventory, as getSlotWithRemainingSpace does Fixes #2865. --- crates/horizon-client/src/game.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/crates/horizon-client/src/game.rs b/crates/horizon-client/src/game.rs index c97af3a47..fc95ca23d 100644 --- a/crates/horizon-client/src/game.rs +++ b/crates/horizon-client/src/game.rs @@ -2317,12 +2317,19 @@ impl Game<'_> { .items() .get(&stack.item) .map_or(64, |i| i.max_stack); - // Prefer the selected slot, then the hotbar, then the main inventory. + // getSlotWithRemainingSpace: the selected slot, the off hand, then + // the hotbar and the main inventory. let order: Vec = std::iter::once(self.selected) + .chain(std::iter::once(shield::OFFHAND_SLOT)) .chain((0..36).filter(|&i| i != self.selected)) .collect(); for &i in &order { - if let Some(slot) = &mut self.inventory[i] + let slot = if i == shield::OFFHAND_SLOT { + &mut self.offhand + } else { + &mut self.inventory[i] + }; + if let Some(slot) = slot && slot.same_item_same_components(&stack) && slot.count < max {