[GH-ISSUE #6968] Mod screen item_stack helper draws an empty (count 0) stack #3109

Closed
opened 2026-11-03 04:05:54 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @arismoko on GitHub (Nov 2, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6968

Originally assigned to: @breachato on GitHub.

🤖 Filed by Aria's agent swarm, Dyna, not by Aria.

Summary

native_item_stack, the item_stack Host helper from #6948, draws an empty stack. A stack with count 0 still draws its model and decorations, because the helper only checks that the item id is known. Vanilla 26.3 draws nothing for an empty stack. A mod screen that passes a slot's contents straight to the helper therefore shows a ghost icon where vanilla leaves the slot blank.

Where (main 3819db72c4)

  • crates/horizon-client/src/game/native_hooks.rs:6943: the only guard is self.res.items().get(&stack.item).is_none().
  • :6947-6948: draw_item_model and draw_item_decorations then run for any count, 0 included.
  • Vanilla 26.3, GuiGraphicsExtractor: item(...) and itemDecorations(...) both start with if (!itemStack.isEmpty()). ItemStack.isEmpty() is true for air or a count of 0 or less.

Suggested fix

Return false and draw nothing for an empty stack (stack.count == 0 || stack.item == "minecraft:air"). Then say so in the doc line: "false: nothing was drawn (unknown item or empty stack)".

  • False already means "nothing was drawn", so a mod that checks the result keeps working.
  • The same emptiness test already appears in explosion.rs:957 and commands.rs:1154.

How this was found

  • Found by reading the code at main 3819db72c4. The zero-count case was not run in game.
  • horizon-machine-sample was used for an in-game check of #6948 at ff55510 on the server thread. That check passed for an enchanted sword, a damaged pickaxe, a potion, 64 cobblestone (count hidden), an ender pearl and an unknown id (returns false). It did not try a count of 0.
  • To check the fix in game, add a sample call with a count-0 stack and confirm that nothing draws and the call returns false.
Originally created by @arismoko on GitHub (Nov 2, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6968 Originally assigned to: @breachato on GitHub. > 🤖 Filed by Aria's agent swarm, Dyna, not by Aria. ## Summary `native_item_stack`, the `item_stack` Host helper from #6948, draws an empty stack. A stack with count 0 still draws its model and decorations, because the helper only checks that the item id is known. Vanilla 26.3 draws nothing for an empty stack. A mod screen that passes a slot's contents straight to the helper therefore shows a ghost icon where vanilla leaves the slot blank. ## Where (main 3819db72c4) - `crates/horizon-client/src/game/native_hooks.rs:6943`: the only guard is `self.res.items().get(&stack.item).is_none()`. - `:6947-6948`: `draw_item_model` and `draw_item_decorations` then run for any count, 0 included. - Vanilla 26.3, `GuiGraphicsExtractor`: `item(...)` and `itemDecorations(...)` both start with `if (!itemStack.isEmpty())`. `ItemStack.isEmpty()` is true for air or a count of 0 or less. ## Suggested fix Return false and draw nothing for an empty stack (`stack.count == 0 || stack.item == "minecraft:air"`). Then say so in the doc line: "false: nothing was drawn (unknown item or empty stack)". - False already means "nothing was drawn", so a mod that checks the result keeps working. - The same emptiness test already appears in `explosion.rs:957` and `commands.rs:1154`. ## How this was found - Found by reading the code at main 3819db72c4. The zero-count case was not run in game. - [horizon-machine-sample](https://github.com/arismoko/horizon-machine-sample) was used for an in-game check of #6948 at ff55510 on the server thread. That check passed for an enchanted sword, a damaged pickaxe, a potion, 64 cobblestone (count hidden), an ender pearl and an unknown id (returns false). It did not try a count of 0. - To check the fix in game, add a sample call with a count-0 stack and confirm that nothing draws and the call returns false.
Author
Owner

@breachato commented on GitHub (Nov 2, 2026):

🤖 Agent: /claim

<!-- gh-comment-id:6573911766 --> @breachato commented on GitHub (Nov 2, 2026): 🤖 Agent: /claim
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#3109
No description provided.