[PR #3435] [MERGED] Native mods: the item panel and recipe pages (hook points v2, 2/2) #4974

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

📋 Pull Request Information

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

Base: main ← Head: feat/native-hooks-v2-recipes


📝 Commits (1)

  • 11f22e2 Native mods: the item panel and recipe pages for native mods

📊 Changes

8 files changed (+630 additions, -139 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+7 -3)
📝 crates/horizon-client/src/game/mod_input.rs (+1 -0)
➕ crates/horizon-client/src/game/mod_panel.rs (+114 -0)
📝 crates/horizon-client/src/game/mods.rs (+0 -3)
📝 crates/horizon-client/src/game/native_hooks.rs (+117 -2)
📝 crates/horizon-client/src/game/native_panel.rs (+313 -104)
📝 crates/horizon-client/src/game/native_panel_recipes.rs (+72 -27)
📝 docs/native-mods.md (+6 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Part 2 of 2 of the native hook points v2, after #3434 (merged): the item panel and its recipe pages for native mods. NATIVE_HOOKS_API becomes 2. This lets the official Recipes mod become a native mod like Zoom, FPS Counter, Keystrokes and Minimap.

  • The panel beside container screens and its recipe pages move from game/mod_browser*.rs to game/native_panel.rs and game/native_panel_recipes.rs. They're built in every build, with their state in Game::panel and native types: NativeStack, NativeRecipeView, NativeRecipeLayout, NativePanelEvent.
  • A native mod shows the panel with native_panel_items and native_panel_recipes.
  • It hears the player's clicks, searches, page turns, tabs, and keys over items through a new hook point, native_panel_event. Keys come by their vanilla names, so a mod compares them with native_mod_key.
  • Who owns the panel:
    • The last mod to show one owns it, and only the owner's empty call clears it.
    • A mod turned off in Options > Mods is skipped.
    • A native mod's panel wins over a WebAssembly mod's.
  • A WebAssembly mod's panel feeds the same state through game/mod_panel.rs (feature mods) and hears its events as before. Players see no change.
  • docs/native-mods.md gains a short section on the panel.

Over the ~500-line guideline: most of the diff is the two renamed files and their switch to native types. The rest is one hook point and two helpers, so it doesn't split further usefully.

Proof

The native Recipes mod (horizon-rust/horizon-mods, native/recipes/, PR to follow) is built on this head with horizon-mixins. It was driven with horizon-ctl --offscreen on fresh data folders, on the Mac mini:

  • Options > Mods shows "Recipes 2.0.0: ON". Its settings page reads the WebAssembly mod's setting file ("Click gives items" on).
  • The panel shows beside a crafting table. A click on its first item gave minecraft:stone ×1 in creative mode.
  • With the setting turned off (the file now says false), the same click opens "Recipes: Stone", with its smelting tab (pixel difference 40.3 in the panel's part of the screen).
  • All five native mods together (fps-overlay, keystrokes, minimap, recipes, zoom) apply and cargo check clean on this head.
pr_ready --quick (rebased head 11f22e2, on main after #3434)

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at e6bb2f74c, 10 min 27 s)

Check Result
Scope ⚠️ 8 files, +630 −139; 763 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅ (1 s)
Python tests ✅ 408 passed (2 min 2 s)
rustfmt ✅ (17 s)
clippy ✅ (1 min 54 s)
tests: horizon-client ✅ 1289 passed (4 min 35 s)
doc tests ✅ 0 passed (1 min 26 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 ➖ 31 affected, to run in CI (--quick): block_removal, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, forced_end, friends_integration, hardcore_respawn, lan_integration, locator_bar and 19 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)
pr_ready, full, with parity (pre-rebase head 1dba99f, stacked on #3434: the same change)

Parity: 34 affected, 33 passed; the other one is lan_integration, which runs only by name. 1286 client tests, clippy clean.

🤖 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/3435 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/native-hooks-v2-recipes` --- ### 📝 Commits (1) - [`11f22e2`](https://github.com/horizon-rust/horizon/commit/11f22e26fae512bb7d4a4f6736ef8ccae5f2f18b) Native mods: the item panel and recipe pages for native mods ### 📊 Changes **8 files changed** (+630 additions, -139 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+7 -3) 📝 `crates/horizon-client/src/game/mod_input.rs` (+1 -0) ➕ `crates/horizon-client/src/game/mod_panel.rs` (+114 -0) 📝 `crates/horizon-client/src/game/mods.rs` (+0 -3) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+117 -2) 📝 `crates/horizon-client/src/game/native_panel.rs` (+313 -104) 📝 `crates/horizon-client/src/game/native_panel_recipes.rs` (+72 -27) 📝 `docs/native-mods.md` (+6 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Part 2 of 2 of the native hook points v2, after #3434 (merged): the item panel and its recipe pages for native mods. `NATIVE_HOOKS_API` becomes 2. This lets the official Recipes mod become a native mod like Zoom, FPS Counter, Keystrokes and Minimap. - The panel beside container screens and its recipe pages move from `game/mod_browser*.rs` to `game/native_panel.rs` and `game/native_panel_recipes.rs`. They're built in every build, with their state in `Game::panel` and native types: `NativeStack`, `NativeRecipeView`, `NativeRecipeLayout`, `NativePanelEvent`. - A native mod shows the panel with `native_panel_items` and `native_panel_recipes`. - It hears the player's clicks, searches, page turns, tabs, and keys over items through a new hook point, `native_panel_event`. Keys come by their vanilla names, so a mod compares them with `native_mod_key`. - Who owns the panel: - The last mod to show one owns it, and only the owner's empty call clears it. - A mod turned off in Options > Mods is skipped. - A native mod's panel wins over a WebAssembly mod's. - A WebAssembly mod's panel feeds the same state through `game/mod_panel.rs` (feature `mods`) and hears its events as before. Players see no change. - `docs/native-mods.md` gains a short section on the panel. Over the ~500-line guideline: most of the diff is the two renamed files and their switch to native types. The rest is one hook point and two helpers, so it doesn't split further usefully. ## Proof The native Recipes mod (horizon-rust/horizon-mods, `native/recipes/`, PR to follow) is built on this head with horizon-mixins. It was driven with `horizon-ctl --offscreen` on fresh data folders, on the Mac mini: - Options > Mods shows "Recipes 2.0.0: ON". Its settings page reads the WebAssembly mod's setting file ("Click gives items" on). - The panel shows beside a crafting table. A click on its first item gave `minecraft:stone` ×1 in creative mode. - With the setting turned off (the file now says `false`), the same click opens "Recipes: Stone", with its smelting tab (pixel difference 40.3 in the panel's part of the screen). - All five native mods together (fps-overlay, keystrokes, minimap, recipes, zoom) apply and `cargo check` clean on this head. <details><summary>pr_ready --quick (rebased head 11f22e2, on main after #3434)</summary> **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at e6bb2f74c, 10 min 27 s) | Check | Result | | --- | --- | | Scope | ⚠️ 8 files, +630 −139; 763 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ (1 s) | | Python tests | ✅ 408 passed (2 min 2 s) | | rustfmt | ✅ (17 s) | | clippy | ✅ (1 min 54 s) | | tests: horizon-client | ✅ 1289 passed (4 min 35 s) | | doc tests | ✅ 0 passed (1 min 26 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 | ➖ 31 affected, to run in CI (--quick): block_removal, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, forced_end, friends_integration, hardcore_respawn, lan_integration, locator_bar and 19 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | </details> <details><summary>pr_ready, full, with parity (pre-rebase head 1dba99f, stacked on #3434: the same change)</summary> Parity: 34 affected, 33 passed; the other one is lan_integration, which runs only by name. 1286 client tests, clippy clean. </details> 🤖 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:17 +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#4974
No description provided.