[PR #3570] [MERGED] Creative tooltips list the tabs that hold the item, as vanilla does #5062

Closed
opened 2026-11-03 05:09:57 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3570
Author: @d3grando
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: fix-3426


📝 Commits (1)

  • 6a59002 Creative tooltips list the tabs that hold the item, as vanilla does

📊 Changes

3 files changed (+225 additions, -8 deletions)

View changed files

📝 crates/horizon-client/src/creative.rs (+165 -0)
📝 crates/horizon-client/src/game.rs (+45 -7)
📝 crates/horizon-client/src/game/stations.rs (+15 -1)

📄 Description

🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando themselves.

What and why

Fixes #3426

In the creative inventory, vanilla adds extra lines after an item's name everywhere except a category tab's own grid. Horizon showed only the plain tooltip everywhere. After this change:

  • Search tab grid: shows the names of the tabs that contain the item, in blue (Oak Log / Building Blocks / Natural Blocks). During a # search it also shows the item's matching tags, in dark purple (#minecraft:oak_logs, ...).
  • Hotbar row under a category tab, and the Survival Inventory tab: show the tab names.
  • A category tab's own grid: keeps the plain tooltip, as before.

How it works:

  • Creative::tabs_containing is CreativeModeTab.contains. It returns the category tabs, in CreativeModeTabs.tabs() order, that hold the stack by item and components, ignoring count. The count does not matter and a damaged tool matches no tab, as vanilla's ItemStackLinkedSet behaves.
    • The export (creative-inventory.json) lists each tab's own items, not its search-tab items.
    • The only stacks this leaves out are the search tab's enchanted books below their top level (SEARCH_TAB_ONLY). They are attributed to the tab that shows their item (Ingredients), which is where vanilla puts them.
  • Creative::search_tag_lines is updateVisibleTags applied to the hovered stack's tags:
    • without a colon, the tag path contains the text after #;
    • with a colon, the namespace and the path each contain their trimmed part.
  • Creative::tooltip_lists_tabs is the CustomCreativeSlot && CATEGORY test.
  • draw_stack_tooltip_with inserts these lines from line 1. getTooltipFromContainerItem puts the tags first, then inserts the tab names from index 1, so the tabs come first. Vanilla's tag order is a HashSet's; Horizon uses the export's order.

Vanilla reference

  • net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen.getTooltipFromContainerItem: hoveredSlot instanceof CustomCreativeSlot, selectedTab.getType() == CATEGORY, visibleTags.forEach (lambda $0: ItemStack.is(tag), "#" + location, DARK_PURPLE, add(1, …)), then CreativeModeTabs.tabs() with the SEARCH type left out, tab.contains(stack), getDisplayName().copy().withStyle(BLUE), add(i++, …).
  • CreativeModeInventoryScreen.updateVisibleTags and its lambdas $0/$1 (String.contains on the path, or on the namespace and the path), called from refreshSearchResults with the text after #.
  • CreativeModeInventoryScreen.ItemPickerMenu: the hotbar row is a plain Slot, not a CustomCreativeSlot.

There is no harness: the creative harness compares tab contents and search results, not tooltips. Unit tests in creative.rs cover the rules.

Self-check

tools/pr_ready.py and tools/parity.py do not run on Windows (signal.SIGHUP is missing). tools/port_ledger.py build needs the decompiled sources, which this machine does not have. I ran these commands instead:

cargo fmt --all -- --check                                                       # OK
cargo clippy -p horizon-client --features mods --all-targets -- -D warnings      # OK
cargo test -p horizon-client --lib creative::                                    # 15 passed
python tools/check_public_tree.py                                                # Public tree check passed.

The new tests, run with Horizon's old behaviour stubbed in (no tab lines, no tag lines):

test creative::tests::tooltip_tab_names_skip_only_a_category_tab_grid ... FAILED
test creative::tests::tooltip_lists_the_tabs_that_contain_the_stack ... FAILED
test creative::tests::tag_search_lists_the_matching_tags_of_the_stack ... FAILED
  left: []
 right: ["minecraft:building_blocks", "minecraft:natural_blocks"]
  left: []
 right: ["#minecraft:logs", "#minecraft:oak_logs", "#minecraft:logs_that_burn"]
test result: FAILED. 0 passed; 3 failed

With the change:

test creative::tests::tooltip_lists_the_tabs_that_contain_the_stack ... ok
test creative::tests::tooltip_tab_names_skip_only_a_category_tab_grid ... ok
test creative::tests::tag_search_lists_the_matching_tags_of_the_stack ... ok
test result: ok. 15 passed; 0 failed

In game

In game (single-player creative world, Oak Log on the hotbar), hovering placed with horizon-ctl scroll-at X Y 0:

Where Before After
Search tab, Oak Log Oak Log Oak Log / Building Blocks / Natural Blocks
Search #logs, Oak Log Oak Log the above, then #minecraft:oak_logs / #minecraft:logs / #minecraft:logs_that_burn
Hotbar row under Building Blocks Oak Log Oak Log / Building Blocks / Natural Blocks
Survival Inventory tab, hotbar Oak Log Oak Log / Building Blocks / Natural Blocks
Building Blocks grid Oak Log Oak Log (unchanged, as vanilla)

🤖 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/3570 **Author:** [@d3grando](https://github.com/d3grando) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix-3426` --- ### 📝 Commits (1) - [`6a59002`](https://github.com/horizon-rust/horizon/commit/6a5900228303a724a4208d9908111cf183fa1eda) Creative tooltips list the tabs that hold the item, as vanilla does ### 📊 Changes **3 files changed** (+225 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/creative.rs` (+165 -0) 📝 `crates/horizon-client/src/game.rs` (+45 -7) 📝 `crates/horizon-client/src/game/stations.rs` (+15 -1) </details> ### 📄 Description > 🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando themselves. ## What and why Fixes #3426 In the creative inventory, vanilla adds extra lines after an item's name everywhere except a category tab's own grid. Horizon showed only the plain tooltip everywhere. After this change: - **Search tab grid:** shows the names of the tabs that contain the item, in blue (`Oak Log` / `Building Blocks` / `Natural Blocks`). During a `#` search it also shows the item's matching tags, in dark purple (`#minecraft:oak_logs`, ...). - **Hotbar row under a category tab, and the Survival Inventory tab:** show the tab names. - **A category tab's own grid:** keeps the plain tooltip, as before. How it works: - `Creative::tabs_containing` is `CreativeModeTab.contains`. It returns the category tabs, in `CreativeModeTabs.tabs()` order, that hold the stack by item and components, ignoring count. The count does not matter and a damaged tool matches no tab, as vanilla's `ItemStackLinkedSet` behaves. - The export (`creative-inventory.json`) lists each tab's own items, not its search-tab items. - The only stacks this leaves out are the search tab's enchanted books below their top level (`SEARCH_TAB_ONLY`). They are attributed to the tab that shows their item (Ingredients), which is where vanilla puts them. - `Creative::search_tag_lines` is `updateVisibleTags` applied to the hovered stack's tags: - without a colon, the tag path contains the text after `#`; - with a colon, the namespace and the path each contain their trimmed part. - `Creative::tooltip_lists_tabs` is the `CustomCreativeSlot && CATEGORY` test. - `draw_stack_tooltip_with` inserts these lines from line 1. `getTooltipFromContainerItem` puts the tags first, then inserts the tab names from index 1, so the tabs come first. Vanilla's tag order is a `HashSet`'s; Horizon uses the export's order. ## Vanilla reference - `net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen.getTooltipFromContainerItem`: `hoveredSlot instanceof CustomCreativeSlot`, `selectedTab.getType() == CATEGORY`, `visibleTags.forEach` (lambda `$0`: `ItemStack.is(tag)`, `"#" + location`, `DARK_PURPLE`, `add(1, …)`), then `CreativeModeTabs.tabs()` with the `SEARCH` type left out, `tab.contains(stack)`, `getDisplayName().copy().withStyle(BLUE)`, `add(i++, …)`. - `CreativeModeInventoryScreen.updateVisibleTags` and its lambdas `$0`/`$1` (`String.contains` on the path, or on the namespace and the path), called from `refreshSearchResults` with the text after `#`. - `CreativeModeInventoryScreen.ItemPickerMenu`: the hotbar row is a plain `Slot`, not a `CustomCreativeSlot`. There is no harness: the `creative` harness compares tab contents and search results, not tooltips. Unit tests in `creative.rs` cover the rules. ## Self-check `tools/pr_ready.py` and `tools/parity.py` do not run on Windows (`signal.SIGHUP` is missing). `tools/port_ledger.py build` needs the decompiled sources, which this machine does not have. I ran these commands instead: ``` cargo fmt --all -- --check # OK cargo clippy -p horizon-client --features mods --all-targets -- -D warnings # OK cargo test -p horizon-client --lib creative:: # 15 passed python tools/check_public_tree.py # Public tree check passed. ``` The new tests, run with Horizon's old behaviour stubbed in (no tab lines, no tag lines): ``` test creative::tests::tooltip_tab_names_skip_only_a_category_tab_grid ... FAILED test creative::tests::tooltip_lists_the_tabs_that_contain_the_stack ... FAILED test creative::tests::tag_search_lists_the_matching_tags_of_the_stack ... FAILED left: [] right: ["minecraft:building_blocks", "minecraft:natural_blocks"] left: [] right: ["#minecraft:logs", "#minecraft:oak_logs", "#minecraft:logs_that_burn"] test result: FAILED. 0 passed; 3 failed ``` With the change: ``` test creative::tests::tooltip_lists_the_tabs_that_contain_the_stack ... ok test creative::tests::tooltip_tab_names_skip_only_a_category_tab_grid ... ok test creative::tests::tag_search_lists_the_matching_tags_of_the_stack ... ok test result: ok. 15 passed; 0 failed ``` ## In game In game (single-player creative world, Oak Log on the hotbar), hovering placed with `horizon-ctl scroll-at X Y 0`: | Where | Before | After | |---|---|---| | Search tab, Oak Log | `Oak Log` | `Oak Log` / `Building Blocks` / `Natural Blocks` | | Search `#logs`, Oak Log | `Oak Log` | the above, then `#minecraft:oak_logs` / `#minecraft:logs` / `#minecraft:logs_that_burn` | | Hotbar row under Building Blocks | `Oak Log` | `Oak Log` / `Building Blocks` / `Natural Blocks` | | Survival Inventory tab, hotbar | `Oak Log` | `Oak Log` / `Building Blocks` / `Natural Blocks` | | Building Blocks grid | `Oak Log` | `Oak Log` (unchanged, as vanilla) | 🤖 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 05:09:57 +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#5062
No description provided.