[PR #5181] [MERGED] Superflat screens: icons from the item's GUI model #6125

Closed
opened 2026-11-03 06:12:29 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5181
Author: @Joansitoh
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: fix/4889-flat-world-item-icons


📝 Commits (1)

  • eb62069 Superflat screens: draw layer and preset icons from the item's GUI model

📊 Changes

5 files changed (+156 additions, -10 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+2 -1)
📝 crates/horizon-client/src/game/startup_menu.rs (+6 -1)
📝 crates/horizon-client/src/item_render/gui.rs (+43 -0)
📝 crates/horizon-client/src/title.rs (+13 -1)
📝 crates/horizon-client/src/title/flat.rs (+92 -7)

📄 Description

🤖 Opened by Joansitoh's AI agent (Claude Code, Sonnet 5.5), not by Joansitoh personally.

What and why

In the Superflat customization screen (layer list and preset list) a block's icon was the flat item/<name> sprite, falling back to a block texture, so blocks showed as the first texture of their model instead of the item's GUI model.

The slots now resolve the item and draw it as GuiGraphics.renderItem does (DisplayContext::Gui through item_render::gui): isometric for blocks, and the water/lava buckets for the fluid layers (FlatLayerInfo's block.asItem()). The flat sprite stays as the fallback (no item models loaded yet, or an id with no model).

HudBatch::clip_since only cuts axis-aligned quads exactly (others are kept or dropped by their centre), so the models are drawn after the list is clipped, through a new gui::draw_scissored that intersects the item's 16x16 slot with the list area (exact triangle clipping, like vanilla's scissor). Title::draw is unchanged for every other screen (draw_with_items with no renderer).

Vanilla reference

CreateFlatWorldScreen (layer list getDisplayItem / fakeItem) and PresetFlatWorldScreen in the 26.3 client sources.

Fixes #4889

pr_ready

pr_ready (tools/pr_ready.py --base upstream/main on tiffany, against upstream/main at fca2169de, 20 min 14 s)

Check Result
Scope ✅ 5 files, +156 −10
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 481 passed (24 s)
rustfmt ✅ (6 s)
clippy ✅ (18 s)
tests: horizon-client ✅ 1065 passed (3 min 16 s)
doc tests ✅ 0 passed (2 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ✅ 38 affected, 37 passed (15 min 48 s)
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

How it was tested

  • Unit test for the layer to item mapping; the 1065 horizon-client tests, clippy and rustfmt pass.
  • The harnesses pr_ready selected pass (37 of 38 affected, run reports Parity pass).
  • Not run in a live game window: I did not look at the screen. The Create World screen is the title/startup menu path, which does not use the in-frame mode.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/5181 **Author:** [@Joansitoh](https://github.com/Joansitoh) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/4889-flat-world-item-icons` --- ### 📝 Commits (1) - [`eb62069`](https://github.com/horizon-rust/horizon/commit/eb62069295573b2134106023bd5a299de13b6ee5) Superflat screens: draw layer and preset icons from the item's GUI model ### 📊 Changes **5 files changed** (+156 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+2 -1) 📝 `crates/horizon-client/src/game/startup_menu.rs` (+6 -1) 📝 `crates/horizon-client/src/item_render/gui.rs` (+43 -0) 📝 `crates/horizon-client/src/title.rs` (+13 -1) 📝 `crates/horizon-client/src/title/flat.rs` (+92 -7) </details> ### 📄 Description > 🤖 Opened by Joansitoh's AI agent (Claude Code, Sonnet 5.5), not by Joansitoh personally. ## What and why In the Superflat customization screen (layer list and preset list) a block's icon was the flat `item/<name>` sprite, falling back to a block texture, so blocks showed as the first texture of their model instead of the item's GUI model. The slots now resolve the item and draw it as `GuiGraphics.renderItem` does (`DisplayContext::Gui` through `item_render::gui`): isometric for blocks, and the water/lava buckets for the fluid layers (`FlatLayerInfo`'s `block.asItem()`). The flat sprite stays as the fallback (no item models loaded yet, or an id with no model). `HudBatch::clip_since` only cuts axis-aligned quads exactly (others are kept or dropped by their centre), so the models are drawn after the list is clipped, through a new `gui::draw_scissored` that intersects the item's 16x16 slot with the list area (exact triangle clipping, like vanilla's scissor). `Title::draw` is unchanged for every other screen (`draw_with_items` with no renderer). ## Vanilla reference `CreateFlatWorldScreen` (layer list `getDisplayItem` / `fakeItem`) and `PresetFlatWorldScreen` in the 26.3 client sources. Fixes #4889 ## pr_ready **pr_ready** (`tools/pr_ready.py --base upstream/main` on tiffany, against upstream/main at fca2169de, 20 min 14 s) | Check | Result | | --- | --- | | Scope | ✅ 5 files, +156 −10 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 481 passed (24 s) | | rustfmt | ✅ (6 s) | | clippy | ✅ (18 s) | | tests: horizon-client | ✅ 1065 passed (3 min 16 s) | | doc tests | ✅ 0 passed (2 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ✅ 38 affected, 37 passed (15 min 48 s) | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | ## How it was tested - Unit test for the layer to item mapping; the 1065 horizon-client tests, clippy and rustfmt pass. - The harnesses `pr_ready` selected pass (37 of 38 affected, run reports Parity pass). - Not run in a live game window: I did not look at the screen. The Create World screen is the title/startup menu path, which does not use the in-frame mode. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:12:29 +07:00
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#6125
No description provided.