Skip to content

Commit 7490b44

Browse files
authored
fix: try_add_item (#540)
Fixes #537
1 parent bf7663b commit 7490b44

File tree

1 file changed

+4
-4
lines changed
  • crates/hyperion-inventory/src

1 file changed

+4
-4
lines changed

crates/hyperion-inventory/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,9 @@ impl PlayerInventory {
295295
pub fn try_add_item(&mut self, mut item: ItemStack) -> AddItemResult {
296296
let mut result = AddItemResult { remaining: None };
297297

298-
// Try to add to hand slots (36-45) first, then the rest of the inventory (0-35)
298+
// Try to add to hot bar (36-45) first, then the rest of the inventory (9-35)
299299
// try to stack first
300-
for slot in (36..=45).chain(0..36) {
300+
for slot in (36..=44).chain(9..36) {
301301
let Ok(add_slot) = self.try_add_to_slot(slot, &mut item, false) else {
302302
unreachable!("try_add_item should always return Ok");
303303
};
@@ -310,9 +310,9 @@ impl PlayerInventory {
310310
}
311311
}
312312

313-
// Try to add to hand slots (36-45) first, then the rest of the inventory (0-35)
313+
// Try to add to hot bar (36-44) first, then the rest of the inventory (9-35)
314314
// now try to add to empty slots
315-
for slot in (36..=45).chain(0..36) {
315+
for slot in (36..=44).chain(9..36) {
316316
let Ok(add_slot) = self.try_add_to_slot(slot, &mut item, true) else {
317317
unreachable!("try_add_item should always return Ok");
318318
};

0 commit comments

Comments
 (0)