[PR #49] [MERGED] Creative inventory: every tab and the search as vanilla builds them; scrollbar drag #2296

Closed
opened 2026-11-02 15:54:43 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: creative


📝 Commits (2)

  • cac89a9 Creative inventory: every tab and the search as vanilla builds them; scrollbar drag
  • 7fab5ec test_creative_parity: no Rust scope (creative.rs reaches item_data and save)

📊 Changes

9 files changed (+778 additions, -123 deletions)

View changed files

➕ crates/horizon-client/examples/creative_search_fixture.rs (+53 -0)
📝 crates/horizon-client/src/creative.rs (+395 -31)
📝 crates/horizon-client/src/game.rs (+23 -27)
📝 crates/horizon-client/src/game/control.rs (+5 -1)
📝 docs/rust-parity.md (+15 -0)
➕ mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCreativeSearchOracle.java (+100 -0)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCreativeTabsExporter.java (+68 -31)
📝 tools/prepare_native_client.py (+9 -33)
➕ tools/test_creative_parity.py (+110 -0)

📄 Description

Fixes two creative-inventory bugs players reported on Discord (v2026.10.13.1).

1. Search misses blocks (anvil, crafting table, smithing table…)

Root cause. creative-tabs.json was exported from a bare bootstrap without the data pack's registries. The functional blocks tab's generator throws on the missing banner_pattern registry (ominous banner), so it exported empty, and recover_creative_tabs' fallback read decompiled sources from .local/decompiled/…, which no longer exists: the tab stayed empty. Anvils, crafting/smithing tables, lecterns, looms, beds, signs… were absent from that tab and the search (the client built its search list from the tabs). The exporter also built the search tab before the category tabs, and the client matched an approximate name rather than what vanilla's search trees index; enchanted books, paintings, goat horns and other registry-driven stacks were missing or lost their components.

Fix.

  • VanillaCreativeTabsExporter now loads the vanilla data pack (ParityData.init) and calls vanilla's own CreativeModeTabs.tryRebuildTabContents. It writes a new creative-inventory.json: every tab's stacks as SNBT with components, and for each search-tab stack its creative tooltip lines and item tags. creative-tabs.json is left alone so other worktrees keep working; the client falls back to it when the new file isn't prepared.
  • horizon_client::creative ports refreshSearchResults and SessionSearchTrees: a substring match over lower-cased tooltip lines; after a colon, the id's namespace and then its path or a line; # searches tags; results keep the tab's order. Changing tab empties the search box (selectTab). The grid carries the stacks' components (potions, enchanted books, paintings…).
  • horizon-ctl type also fills the creative search box (needed for the screenshots: vscreen type's wtype keymap reaches the game as Escape/1/2… physical keys).

2. Scrollbar drag stops

Root cause. Nothing handled dragging: pressing the track jumped the thumb to the pressed point once, then mouse movement was ignored.

Fix. Following mouseClicked/mouseDragged/mouseReleased: a left press on the track holds the scrollbar (if the tab has more than 45 items) without moving it; while held, every cursor move sets scrollOffs = (y - top - 7.5) / (112 - 15) clamped, wherever the cursor is (off the track, the panel or the window), until release. The wheel uses subtractInputFromScroll (scroll amount / hidden rows), and the scroller sprite is drawn at (int)(95 * scrollOffs). Unit tests cover the drag, release and wheel.

Checks

  • tools/test_creative_parity.py (new; oracle VanillaCreativeSearchOracle drives the vanilla client's own SessionSearchTrees): all 12 shown tabs match stack for stack with components (functional blocks: 284; search: 2,000 stacks), and 6,793/6,793 searches match (fixed queries, then every stack's item path and tooltip lines and every tag, whole and halved). Passed 3 runs in a row.
  • cargo test -p horizon-client, clippy -D warnings, rustfmt, tools/gate.py --quick: pass.
  • In game (vscreen, lavapipe): searching "anvil" shows the three anvils, "crafting" the crafting table, "smithing" the smithing table and the 19 smithing templates. A drag couldn't be reproduced on vscreen: sway's seat-pointer commands deliver no motion while a button is held.

Players' resources need tools/prepare_native_client.py to run again (the exporter's hash changed), which writes creative-inventory.json.

Not covered: the operator tab (off by default, operatorItemsTab) and the saved-hotbars tab.

🤖 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/49 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/13/2026 **Status:** ✅ Merged **Merged:** 10/13/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `creative` --- ### 📝 Commits (2) - [`cac89a9`](https://github.com/horizon-rust/horizon/commit/cac89a9995fa4d034f5d905eb1c7e8fc0d5a0269) Creative inventory: every tab and the search as vanilla builds them; scrollbar drag - [`7fab5ec`](https://github.com/horizon-rust/horizon/commit/7fab5ec1ff9214c43c3ad3699ef476d9dbaf458b) test_creative_parity: no Rust scope (creative.rs reaches item_data and save) ### 📊 Changes **9 files changed** (+778 additions, -123 deletions) <details> <summary>View changed files</summary> ➕ `crates/horizon-client/examples/creative_search_fixture.rs` (+53 -0) 📝 `crates/horizon-client/src/creative.rs` (+395 -31) 📝 `crates/horizon-client/src/game.rs` (+23 -27) 📝 `crates/horizon-client/src/game/control.rs` (+5 -1) 📝 `docs/rust-parity.md` (+15 -0) ➕ `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCreativeSearchOracle.java` (+100 -0) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCreativeTabsExporter.java` (+68 -31) 📝 `tools/prepare_native_client.py` (+9 -33) ➕ `tools/test_creative_parity.py` (+110 -0) </details> ### 📄 Description Fixes two creative-inventory bugs players reported on Discord (v2026.10.13.1). ## 1. Search misses blocks (anvil, crafting table, smithing table…) **Root cause.** `creative-tabs.json` was exported from a bare bootstrap without the data pack's registries. The functional blocks tab's generator throws on the missing `banner_pattern` registry (ominous banner), so it exported empty, and `recover_creative_tabs`' fallback read decompiled sources from `.local/decompiled/…`, which no longer exists: the tab stayed empty. Anvils, crafting/smithing tables, lecterns, looms, beds, signs… were absent from that tab *and* the search (the client built its search list from the tabs). The exporter also built the search tab before the category tabs, and the client matched an approximate name rather than what vanilla's search trees index; enchanted books, paintings, goat horns and other registry-driven stacks were missing or lost their components. **Fix.** - `VanillaCreativeTabsExporter` now loads the vanilla data pack (`ParityData.init`) and calls vanilla's own `CreativeModeTabs.tryRebuildTabContents`. It writes a new `creative-inventory.json`: every tab's stacks as SNBT with components, and for each search-tab stack its creative tooltip lines and item tags. `creative-tabs.json` is left alone so other worktrees keep working; the client falls back to it when the new file isn't prepared. - `horizon_client::creative` ports `refreshSearchResults` and `SessionSearchTrees`: a substring match over lower-cased tooltip lines; after a colon, the id's namespace and then its path or a line; `#` searches tags; results keep the tab's order. Changing tab empties the search box (`selectTab`). The grid carries the stacks' components (potions, enchanted books, paintings…). - horizon-ctl `type` also fills the creative search box (needed for the screenshots: `vscreen type`'s wtype keymap reaches the game as Escape/1/2… physical keys). ## 2. Scrollbar drag stops **Root cause.** Nothing handled dragging: pressing the track jumped the thumb to the pressed point once, then mouse movement was ignored. **Fix.** Following `mouseClicked`/`mouseDragged`/`mouseReleased`: a left press on the track holds the scrollbar (if the tab has more than 45 items) without moving it; while held, every cursor move sets `scrollOffs = (y - top - 7.5) / (112 - 15)` clamped, wherever the cursor is (off the track, the panel or the window), until release. The wheel uses `subtractInputFromScroll` (scroll amount / hidden rows), and the scroller sprite is drawn at `(int)(95 * scrollOffs)`. Unit tests cover the drag, release and wheel. ## Checks - `tools/test_creative_parity.py` (new; oracle `VanillaCreativeSearchOracle` drives the vanilla client's own `SessionSearchTrees`): all 12 shown tabs match stack for stack with components (functional blocks: 284; search: 2,000 stacks), and 6,793/6,793 searches match (fixed queries, then every stack's item path and tooltip lines and every tag, whole and halved). Passed 3 runs in a row. - `cargo test -p horizon-client`, clippy `-D warnings`, rustfmt, `tools/gate.py --quick`: pass. - In game (vscreen, lavapipe): searching "anvil" shows the three anvils, "crafting" the crafting table, "smithing" the smithing table and the 19 smithing templates. A drag couldn't be reproduced on vscreen: sway's seat-pointer commands deliver no motion while a button is held. Players' resources need `tools/prepare_native_client.py` to run again (the exporter's hash changed), which writes `creative-inventory.json`. Not covered: the operator tab (off by default, `operatorItemsTab`) and the saved-hotbars tab. 🤖 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-02 15:54:43 +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#2296
No description provided.