[PR #4052] [MERGED] Creative inventory: the Operator Utilities tab for operators #5381

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

📋 Pull Request Information

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

Base: main ← Head: fix-3393-optab


📝 Commits (3)

  • d4a973f Creative inventory: the Operator Utilities tab for operators
  • 4d1f533 Creative tab selection test: give the category tab a stack
  • 633cd1d Merge origin/main into fix-3393-optab

📊 Changes

9 files changed (+343 additions, -87 deletions)

View changed files

📝 crates/horizon-client-render/src/options_ui.rs (+11 -3)
📝 crates/horizon-client/examples/probe/creative_search_fixture.rs (+7 -4)
📝 crates/horizon-client/src/creative.rs (+239 -55)
📝 crates/horizon-client/src/game.rs (+16 -1)
📝 crates/horizon-client/src/game/remote.rs (+1 -0)
📝 docs/rust-parity.md (+8 -3)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCreativeSearchOracle.java (+7 -3)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCreativeTabsExporter.java (+33 -10)
📝 tools/test_creative_parity.py (+21 -8)

📄 Description

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

What and why

Part of #3393 (its first item: "The Operator tab cannot be enabled").

Root cause. Controls... > Operator Items Tab was greyed out on purpose (Opt::available, "the creative tabs don't read it yet"), and there was nothing to read it with: VanillaCreativeTabsExporter built the tabs with HAS_PERMISSIONS = false, so creative-inventory.json listed minecraft:op_blocks with no stacks and visible: false, and Creative::from_json dropped it. The command blocks, structure blocks, jigsaw, barrier, debug stick, test blocks, the 16 light levels and the non-placeable paintings were missing from both the tab and the search tab.

Fix.

  • Export (VanillaCreativeTabsExporter): build the tabs without permissions, then with them. Each tab lists the stacks of the build with permissions, plus permissions_only, the indices of the stacks that only that build has. visible still means "without permissions". The exporter fails if dropping those indices does not give back the build without permissions, in order. Schema 3. The exporter's source hash changes, so horizon-prepare re-exports on the next prepare. An older export has no permissions_only, so the operator tab stays hidden, as it did before.
  • Client (creative.rs): Creative keeps every exported stack and rebuilds its shown tabs and search stacks for one hasPermissions value (CreativeModeTabs.buildAllTabContents). A category tab is shown only when it has stacks (CreativeModeTab.shouldDisplay). set_permissions follows CreativeModeInventoryScreen.tryRefreshInvalidatedTabs: it rebuilds only when the value changes. A selected tab that is left empty (the operator tab) gives way to getDefaultTab (Building Blocks). Any other selected tab keeps its first row (refreshCurrentTabContents / getScrollForRowIndex).
  • Game: hasPermissions = canUseGameMasterBlocks() (creative and permission level 2 or more) and the option. It is checked when the creative screen opens (the screen's constructor) and on every tick while it is open (containerTick). This works in single player and on a server's client, so you see the change when you are opped, deopped, or change the option.
  • Options: the Operator Items Tab button can be switched again.

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

From the 26.3 jars (javap -c):

  • CreativeModeTabs.bootstrap: the OP_BLOCKS generator (lambda$bootstrap$33) lists its stacks only when ItemDisplayParameters.hasPermissions(). Its stacks use the default PARENT_AND_SEARCH_TABS visibility, so they also go into the search tab.
  • CreativeModeTabs.tryRebuildTabContents, buildAllTabContents, getDefaultTab.
  • CreativeModeTab.shouldDisplay.
  • CreativeModeInventoryScreen.<init>, hasPermissions (Player.canUseGameMasterBlocks() && displayOperatorCreativeTab), containerTick, tryRefreshInvalidatedTabs, refreshCurrentTabContents, getTabX (the tab is alignedRight, column 5).
  • ItemPickerMenu.getScrollForRowIndex.
  • Player.canUseGameMasterBlocks.

Harness: tools/test_creative_parity.py now runs twice. The first run is as before. The second run passes permissions to VanillaCreativeSearchOracle and to creative_search_fixture, so vanilla builds its tabs and search trees with hasPermissions = true and Horizon calls set_permissions(true). Both runs compare every shown tab's stacks, the search tab and every search.

Self-check

tools/pr_ready.py doesn't run on Windows, so these are the commands it would run for the touched crates:

  • cargo fmt --all -- --check: ok.

  • cargo clippy -p horizon-client-render --all-targets -- -D warnings: ok.

  • cargo clippy -p horizon-client --all-targets -- -D warnings: ok.

  • cargo test -p horizon-client --lib creative::tests: 18 passed. New tests: operator_stacks_stay_out_without_permissions and operator_tab_comes_and_goes_with_permissions.

  • cargo test -p horizon-client-render --lib options_ui::tests: 35 passed, 1 ignored. New test: operator_items_tab_option_can_be_switched.

  • cargo test -p horizon-client --bin horizon-client game::tests::selecting_creative: 1 passed (its fixture's category tab now holds a stack, since an empty category tab is hidden). creative filter: 25 passed (lib), 3 passed (bin).

  • Creative parity, tools/test_creative_parity.py (the harness tools/parity.py creative runs; run directly on Windows, where parity.py itself doesn't run), with the oracle run fresh: creative parity ok on both.

    origin/main (d6adbe1cb) this branch
    Without permissions 12 tabs, 2000 search stacks, 6793/6793 searches match the same
    With permissions not run 13 tabs (minecraft:op_blocks, 34 stacks), 2034 search stacks, 6845/6845 searches match

    Without permissions every tab's stacks (475 / 278 / 254 / 284 / 70 / 158 / 126 / 195 / 194 / 89) are the same on both.

  • python -m unittest tests.test_prepare_exporters tests.test_prepare_output: ok.

  • python tools/check_public_tree.py: passed.

Before the fix. The new tests were run against the code on origin/main:

  • options_ui::tests::operator_items_tab_option_can_be_switched FAILED: assertion failed: Opt::OperatorItemsTab.available().
  • creative::tests::operator_stacks_stay_out_without_permissions FAILED: left: 3, right: 1. The export's operator stacks leak into the search tab without permissions.
  • operator_tab_comes_and_goes_with_permissions needs the new set_permissions, so it doesn't build on main.

In game (fast build, single player on the server thread, plus a LAN guest):

  • Before (main build, operatorItemsTab:true already in options.txt): the button reads "Operator Items Tab: ON" but is disabled (horizon-ctl click answers "widget is disabled"). The creative inventory has no operator tab.
  • After, single player:
    • With the option off, there is no operator tab.
    • After switching the option on in Controls, the command block tab appears in the bottom row next to the Survival Inventory tab. It shows Operator Utilities: the command blocks, the command block minecart, jigsaw, structure block and void, barrier, debug stick, the test blocks, lights 15 to 0 and the paintings.
    • Searching "command" finds the three command blocks and the minecart.
    • Switching the option off (options-set) while the operator tab is open moves the screen to Building Blocks on the next tick.
  • After, LAN guest with the option on:
    • World opened without cheats: the guest has no operator tab.
    • World reopened with cheats: the guest has the tab.

Screenshots

before: Operator Items Tab greyed out in Controls

after: the Operator Utilities tab in the creative inventory

  • Before: the Operator Items Tab button is greyed out in Controls, and the creative inventory's bottom row ends with spawn eggs, then a gap, then the chest.
  • After: the button switches. The command block tab sits at column 5 of the bottom row and opens "Operator Utilities" with its 34 stacks. "command" in the search tab finds the command blocks.

🤖 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/4052 **Author:** [@d3grando](https://github.com/d3grando) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix-3393-optab` --- ### 📝 Commits (3) - [`d4a973f`](https://github.com/horizon-rust/horizon/commit/d4a973f65f1afd93595638cd8ddb79e60d9d645d) Creative inventory: the Operator Utilities tab for operators - [`4d1f533`](https://github.com/horizon-rust/horizon/commit/4d1f533af69141bb92b930a58038c5b884bb5104) Creative tab selection test: give the category tab a stack - [`633cd1d`](https://github.com/horizon-rust/horizon/commit/633cd1dbce100b955a437574b77853ded4cddb55) Merge origin/main into fix-3393-optab ### 📊 Changes **9 files changed** (+343 additions, -87 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/options_ui.rs` (+11 -3) 📝 `crates/horizon-client/examples/probe/creative_search_fixture.rs` (+7 -4) 📝 `crates/horizon-client/src/creative.rs` (+239 -55) 📝 `crates/horizon-client/src/game.rs` (+16 -1) 📝 `crates/horizon-client/src/game/remote.rs` (+1 -0) 📝 `docs/rust-parity.md` (+8 -3) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCreativeSearchOracle.java` (+7 -3) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCreativeTabsExporter.java` (+33 -10) 📝 `tools/test_creative_parity.py` (+21 -8) </details> ### 📄 Description > 🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando personally. ## What and why Part of #3393 (its first item: "The Operator tab cannot be enabled"). **Root cause.** `Controls... > Operator Items Tab` was greyed out on purpose (`Opt::available`, "the creative tabs don't read it yet"), and there was nothing to read it with: `VanillaCreativeTabsExporter` built the tabs with `HAS_PERMISSIONS = false`, so `creative-inventory.json` listed `minecraft:op_blocks` with no stacks and `visible: false`, and `Creative::from_json` dropped it. The command blocks, structure blocks, jigsaw, barrier, debug stick, test blocks, the 16 light levels and the non-placeable paintings were missing from both the tab and the search tab. **Fix.** - **Export** (`VanillaCreativeTabsExporter`): build the tabs without permissions, then with them. Each tab lists the stacks of the build with permissions, plus `permissions_only`, the indices of the stacks that only that build has. `visible` still means "without permissions". The exporter fails if dropping those indices does not give back the build without permissions, in order. Schema 3. The exporter's source hash changes, so `horizon-prepare` re-exports on the next prepare. An older export has no `permissions_only`, so the operator tab stays hidden, as it did before. - **Client** (`creative.rs`): `Creative` keeps every exported stack and rebuilds its shown tabs and search stacks for one `hasPermissions` value (`CreativeModeTabs.buildAllTabContents`). A category tab is shown only when it has stacks (`CreativeModeTab.shouldDisplay`). `set_permissions` follows `CreativeModeInventoryScreen.tryRefreshInvalidatedTabs`: it rebuilds only when the value changes. A selected tab that is left empty (the operator tab) gives way to `getDefaultTab` (Building Blocks). Any other selected tab keeps its first row (`refreshCurrentTabContents` / `getScrollForRowIndex`). - **Game**: `hasPermissions` = `canUseGameMasterBlocks()` (creative and permission level 2 or more) and the option. It is checked when the creative screen opens (the screen's constructor) and on every tick while it is open (`containerTick`). This works in single player and on a server's client, so you see the change when you are opped, deopped, or change the option. - **Options**: the Operator Items Tab button can be switched again. ## Kind - [x] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference From the 26.3 jars (`javap -c`): - `CreativeModeTabs.bootstrap`: the `OP_BLOCKS` generator (`lambda$bootstrap$33`) lists its stacks only when `ItemDisplayParameters.hasPermissions()`. Its stacks use the default `PARENT_AND_SEARCH_TABS` visibility, so they also go into the search tab. - `CreativeModeTabs.tryRebuildTabContents`, `buildAllTabContents`, `getDefaultTab`. - `CreativeModeTab.shouldDisplay`. - `CreativeModeInventoryScreen.<init>`, `hasPermissions` (`Player.canUseGameMasterBlocks() && displayOperatorCreativeTab`), `containerTick`, `tryRefreshInvalidatedTabs`, `refreshCurrentTabContents`, `getTabX` (the tab is `alignedRight`, column 5). - `ItemPickerMenu.getScrollForRowIndex`. - `Player.canUseGameMasterBlocks`. **Harness:** `tools/test_creative_parity.py` now runs twice. The first run is as before. The second run passes `permissions` to `VanillaCreativeSearchOracle` and to `creative_search_fixture`, so vanilla builds its tabs and search trees with `hasPermissions = true` and Horizon calls `set_permissions(true)`. Both runs compare every shown tab's stacks, the search tab and every search. ## Self-check `tools/pr_ready.py` doesn't run on Windows, so these are the commands it would run for the touched crates: - `cargo fmt --all -- --check`: ok. - `cargo clippy -p horizon-client-render --all-targets -- -D warnings`: ok. - `cargo clippy -p horizon-client --all-targets -- -D warnings`: ok. - `cargo test -p horizon-client --lib creative::tests`: 18 passed. New tests: `operator_stacks_stay_out_without_permissions` and `operator_tab_comes_and_goes_with_permissions`. - `cargo test -p horizon-client-render --lib options_ui::tests`: 35 passed, 1 ignored. New test: `operator_items_tab_option_can_be_switched`. - `cargo test -p horizon-client --bin horizon-client game::tests::selecting_creative`: 1 passed (its fixture's category tab now holds a stack, since an empty category tab is hidden). `creative` filter: 25 passed (lib), 3 passed (bin). - Creative parity, `tools/test_creative_parity.py` (the harness `tools/parity.py creative` runs; run directly on Windows, where `parity.py` itself doesn't run), with the oracle run fresh: creative parity ok on both. | | `origin/main` (d6adbe1cb) | this branch | |---|---|---| | Without permissions | 12 tabs, 2000 search stacks, 6793/6793 searches match | the same | | With permissions | not run | 13 tabs (`minecraft:op_blocks`, 34 stacks), 2034 search stacks, 6845/6845 searches match | Without permissions every tab's stacks (475 / 278 / 254 / 284 / 70 / 158 / 126 / 195 / 194 / 89) are the same on both. - `python -m unittest tests.test_prepare_exporters tests.test_prepare_output`: ok. - `python tools/check_public_tree.py`: passed. **Before the fix.** The new tests were run against the code on `origin/main`: - `options_ui::tests::operator_items_tab_option_can_be_switched` FAILED: `assertion failed: Opt::OperatorItemsTab.available()`. - `creative::tests::operator_stacks_stay_out_without_permissions` FAILED: `left: 3, right: 1`. The export's operator stacks leak into the search tab without permissions. - `operator_tab_comes_and_goes_with_permissions` needs the new `set_permissions`, so it doesn't build on main. **In game** (fast build, single player on the server thread, plus a LAN guest): - **Before** (main build, `operatorItemsTab:true` already in `options.txt`): the button reads "Operator Items Tab: ON" but is disabled (`horizon-ctl click` answers "widget is disabled"). The creative inventory has no operator tab. - **After, single player:** - With the option off, there is no operator tab. - After switching the option on in Controls, the command block tab appears in the bottom row next to the Survival Inventory tab. It shows Operator Utilities: the command blocks, the command block minecart, jigsaw, structure block and void, barrier, debug stick, the test blocks, lights 15 to 0 and the paintings. - Searching "command" finds the three command blocks and the minecart. - Switching the option off (`options-set`) while the operator tab is open moves the screen to Building Blocks on the next tick. - **After, LAN guest** with the option on: - World opened without cheats: the guest has no operator tab. - World reopened with cheats: the guest has the tab. ## Screenshots ![before: Operator Items Tab greyed out in Controls](https://raw.githubusercontent.com/d3grando/horizon/pr-assets/3393-optab-1.png) ![after: the Operator Utilities tab in the creative inventory](https://raw.githubusercontent.com/d3grando/horizon/pr-assets/3393-optab-2.png) - **Before:** the Operator Items Tab button is greyed out in Controls, and the creative inventory's bottom row ends with spawn eggs, then a gap, then the chest. - **After:** the button switches. The command block tab sits at column 5 of the bottom row and opens "Operator Utilities" with its 34 stacks. "command" in the search tab finds the command blocks. 🤖 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:12:12 +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#5381
No description provided.