[GH-ISSUE #6563] Draw an ItemStack with its components on a mod screen #2136

Closed
opened 2026-11-02 15:52:23 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @JuanLuci on GitHub (Nov 1, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6563

Originally assigned to: @Xmilon on GitHub.

Summary

A helper that draws a whole ItemStack on a mod screen, with its components: enchantment glint, damage bar, potion colour, custom model. Today the screen helpers only take an item id.

Why

  • native_item(batch, item, at, size) (API 20) builds ItemStack::new(item, 1) and draws that, so every component is lost.
  • native_item_model (API 111) changes the model, and nothing else about the stack.
  • native_draw_item (API 91) does take a stack, but it draws into a BlockEntityDraw, in native_block_entity_submit.

So a screen that lists items can't show what tells them apart. That covers storage terminals and drawers, filter and ghost slots, recipe pages with enchanted or potion results, and any shop or reward list. A player can't tell a Sharpness V sword from a plain one before clicking on it.

Proposal

  • native_item_stack(batch, stack: &ItemStack, at, size) -> bool, next to native_item, going through draw_item_model as a slot does, so glint and the stack's own model come for free. False for an unknown item.
  • A way to draw the slot decorations too, or a second helper for them: the damage bar and mod decorations (native_item_bar, native_item_decorations) as a slot draws them. The count stays the mod's choice, since a storage list has its own format for it.

On my port

The Storage Terminal of Tom's Simple Storage (tom5454, MIT) lists entries by item and components. My port's server side keeps them apart, and its client draws them with native_item. I found this on Nightly c9d474d.

The test, on main at f8bfa06b9, with the port running: a chest holding a diamond sword with Sharpness V, a plain one, one with damage=1000, an enchanted book with Mending and one with Unbreaking III. The terminal lists each of them as its own entry, as it should. But the three swords draw the same plain icon, with no glint and no damage bar, and so do the two books.

There is no workaround: entries with the same id look the same. The tooltip could tell them apart, but the port only has the name and count to put there, as the client's list holds no stack.

Originally created by @JuanLuci on GitHub (Nov 1, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6563 Originally assigned to: @Xmilon on GitHub. ## Summary A helper that draws a whole `ItemStack` on a mod screen, with its components: enchantment glint, damage bar, potion colour, custom model. Today the screen helpers only take an item id. ## Why - `native_item(batch, item, at, size)` (API 20) builds `ItemStack::new(item, 1)` and draws that, so every component is lost. - `native_item_model` (API 111) changes the model, and nothing else about the stack. - `native_draw_item` (API 91) does take a stack, but it draws into a `BlockEntityDraw`, in `native_block_entity_submit`. So a screen that lists items can't show what tells them apart. That covers storage terminals and drawers, filter and ghost slots, recipe pages with enchanted or potion results, and any shop or reward list. A player can't tell a Sharpness V sword from a plain one before clicking on it. ## Proposal - `native_item_stack(batch, stack: &ItemStack, at, size) -> bool`, next to `native_item`, going through `draw_item_model` as a slot does, so glint and the stack's own model come for free. False for an unknown item. - A way to draw the slot decorations too, or a second helper for them: the damage bar and mod decorations (`native_item_bar`, `native_item_decorations`) as a slot draws them. The count stays the mod's choice, since a storage list has its own format for it. ## On my port The Storage Terminal of Tom's Simple Storage (tom5454, MIT) lists entries by item and components. My port's server side keeps them apart, and its client draws them with `native_item`. I found this on Nightly c9d474d. The test, on main at f8bfa06b9, with the port running: a chest holding a diamond sword with Sharpness V, a plain one, one with `damage=1000`, an enchanted book with Mending and one with Unbreaking III. The terminal lists each of them as its own entry, as it should. But the three swords draw the same plain icon, with no glint and no damage bar, and so do the two books. There is no workaround: entries with the same id look the same. The tooltip could tell them apart, but the port only has the name and count to put there, as the client's list holds no stack.
Author
Owner

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

🤖 Agent: /claim (Xmilon's AI agent, Claude Code)

<!-- gh-comment-id:6573204771 --> @Xmilon commented on GitHub (Nov 2, 2026): 🤖 Agent: /claim (Xmilon's AI agent, Claude Code)
Author
Owner

@github-actions[bot] commented on GitHub (Nov 2, 2026):

🤖 Claims: refused, Xmilons AI agent Claude Code isn't understood here. Use /claim or /unclaim (the trusted reviewers: /unclaim @login). (asked by @Xmilon)

<!-- gh-comment-id:6573207126 --> @github-actions[bot] commented on GitHub (Nov 2, 2026): 🤖 Claims: refused, `Xmilons AI agent Claude Code` isn't understood here. Use `/claim` or `/unclaim` (the trusted reviewers: `/unclaim @login`). (asked by @Xmilon)
Author
Owner

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

🤖 Agent: /claim

<!-- gh-comment-id:6573263055 --> @Xmilon 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#2136
No description provided.