[PR #3434] [MERGED] Native mods: recipe tables, recipe book, place and give helpers (hook points v2, 1/2) #4973

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/3434
Author: @ludovic111
Created: 10/28/2026
Status: ✅ Merged
Merged: 10/28/2026
Merged by: @ludovic111

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


📝 Commits (1)

  • 6a22189 Native mods: recipe tables, recipe book, place and give for native mods (hook points v2)

📊 Changes

6 files changed (+258 additions, -30 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+4 -2)
📝 crates/horizon-client/src/game/mod_browser.rs (+1 -1)
📝 crates/horizon-client/src/game/mods.rs (+0 -3)
📝 crates/horizon-client/src/game/native_hooks.rs (+113 -1)
📝 crates/horizon-client/src/game/native_recipes.rs (+140 -19)
📝 crates/horizon-client/src/game/recipe_book.rs (+0 -4)

📄 Description

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

Part 1 of 2 of the native hook points v2 that the native Recipes mod needs (the WebAssembly mods are going away; see the removal drafts #3350, #3351, #3353 and #3371). Part 2, the item panel and NATIVE_HOOKS_API = 2, is stacked on this one.

  • The item and recipe tables that WebAssembly mods read through capability recipes move from game/mod_recipes.rs to game/native_recipes.rs. That file is built in every build (no mods feature), with native types: NativeRecipes, NativeRecipe, NativeItem, NativeRecipeStack, NativeRecipeKind.

  • Native mods get four helpers in native_hooks.rs:

    • native_recipes: the tables, made once, none outside a world.
    • native_known_recipes: the recipe book's ids now.
    • native_place_recipe: what a click in the recipe book does.
    • native_give: creative only, one stack.

    They refuse what recipes.place and recipes.give refuse.

  • WebAssembly mods read the same tables, converted once to the runtime's types. Players see no change.

Tests

  • cargo test -p horizon-client --lib --bins --tests, with and without --features mods.
  • clippy -D warnings on both.
  • The native Recipes mod (horizon-rust/horizon-mods, native/recipes/, PR to follow) builds on part 2 and its proof passes in the game. Details in part 2.
pr_ready (run on part 2's head, 1dba99f, which contains this commit)

pr_ready (tools/pr_ready.py on ludovics-mac-mini, against origin/main at 6f8c7a0e5, 37 min 6 s)

Check Result
Scope ⚠️ 10 files, +887 −168; 1049 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 408 passed (1 min 17 s)
rustfmt ✅ (5 s)
clippy ✅ (55 s)
tests: horizon-client ✅ 1286 passed (2 min 59 s)
doc tests ✅ 0 passed (50 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 ✅ 34 affected, 33 passed (30 min 54 s)
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 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/3434 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/28/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/native-hooks-v2-tables` --- ### 📝 Commits (1) - [`6a22189`](https://github.com/horizon-rust/horizon/commit/6a221890bd21f083551d75df22f4842aac880aca) Native mods: recipe tables, recipe book, place and give for native mods (hook points v2) ### 📊 Changes **6 files changed** (+258 additions, -30 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+4 -2) 📝 `crates/horizon-client/src/game/mod_browser.rs` (+1 -1) 📝 `crates/horizon-client/src/game/mods.rs` (+0 -3) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+113 -1) 📝 `crates/horizon-client/src/game/native_recipes.rs` (+140 -19) 📝 `crates/horizon-client/src/game/recipe_book.rs` (+0 -4) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Part 1 of 2 of the native hook points v2 that the native Recipes mod needs (the WebAssembly mods are going away; see the removal drafts #3350, #3351, #3353 and #3371). Part 2, the item panel and `NATIVE_HOOKS_API = 2`, is stacked on this one. - The item and recipe tables that WebAssembly mods read through capability `recipes` move from `game/mod_recipes.rs` to `game/native_recipes.rs`. That file is built in every build (no `mods` feature), with native types: `NativeRecipes`, `NativeRecipe`, `NativeItem`, `NativeRecipeStack`, `NativeRecipeKind`. - Native mods get four helpers in `native_hooks.rs`: - `native_recipes`: the tables, made once, none outside a world. - `native_known_recipes`: the recipe book's ids now. - `native_place_recipe`: what a click in the recipe book does. - `native_give`: creative only, one stack. They refuse what `recipes.place` and `recipes.give` refuse. - WebAssembly mods read the same tables, converted once to the runtime's types. Players see no change. ## Tests - `cargo test -p horizon-client --lib --bins --tests`, with and without `--features mods`. - clippy `-D warnings` on both. - The native Recipes mod (horizon-rust/horizon-mods, `native/recipes/`, PR to follow) builds on part 2 and its proof passes in the game. Details in part 2. <details><summary>pr_ready (run on part 2's head, 1dba99f, which contains this commit)</summary> **pr_ready** (`tools/pr_ready.py` on ludovics-mac-mini, against origin/main at 6f8c7a0e5, 37 min 6 s) | Check | Result | | --- | --- | | Scope | ⚠️ 10 files, +887 −168; 1049 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 408 passed (1 min 17 s) | | rustfmt | ✅ (5 s) | | clippy | ✅ (55 s) | | tests: horizon-client | ✅ 1286 passed (2 min 59 s) | | doc tests | ✅ 0 passed (50 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 | ✅ 34 affected, 33 passed (30 min 54 s) | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | </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#4973
No description provided.