[PR #5120] [MERGED] Native mods: recipe helpers work on servers, which have no player #6088

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

📋 Pull Request Information

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

Base: main ← Head: native-recipes-on-servers


📝 Commits (1)

  • 3b77664 Native mods: recipe helpers work on servers, which have no player

📊 Changes

1 file changed (+13 additions, -3 deletions)

View changed files

📝 crates/horizon-client/src/game/native_hooks.rs (+13 -3)

📄 Description

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

Fixes #5119. native_recipes_of_type, native_recipe_ingredient and native_recipe_result returned nothing on a server's Game (the server thread, a dedicated server, a LAN host): their "outside a world" check was self.player.is_none(), and a server's Game never has a player of its own. So a machine ticking on the server got no recipes, though the docs say these are the server's table.

outside_world() is now "a client with no player" (the title screen). The docs and signatures are unchanged; no new hook, no API bump.

Tested in the game (offscreen, single player): a native mod's machine reads its recipes by type from a content mod (1,666 recipes of one type, in subfolders) and runs them on the server thread. A world data pack that replaces one of them by id is picked up by /reload while the machine runs. Before the fix the same machine found none (native_recipes_of_type empty while recipes().custom held the type).

Note: recipes in subfolders of a content mod (data/mymod/recipe/crusher/iron.json) also need #5026 (open), which I merged locally for the test.

pr_ready (tools/pr_ready.py --quick, against origin/main at c3905131b)

Check Result
Scope ✅ 1 file, +13 −3
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 495 passed
rustfmt ✅
clippy ✅
tests: horizon-client ✅ 1340 passed
Parity ➖ not run (--quick)

🤖 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/5120 **Author:** [@Sylviromi](https://github.com/Sylviromi) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `native-recipes-on-servers` --- ### 📝 Commits (1) - [`3b77664`](https://github.com/horizon-rust/horizon/commit/3b77664bdb690f1977669db25ced64e97dacc8e5) Native mods: recipe helpers work on servers, which have no player ### 📊 Changes **1 file changed** (+13 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/native_hooks.rs` (+13 -3) </details> ### 📄 Description > 🤖 Opened by Sylviromi's AI agent (Claude Code, Claude Opus 5.5), not by Sylviromi personally. Fixes #5119. `native_recipes_of_type`, `native_recipe_ingredient` and `native_recipe_result` returned nothing on a server's `Game` (the server thread, a dedicated server, a LAN host): their "outside a world" check was `self.player.is_none()`, and a server's `Game` never has a player of its own. So a machine ticking on the server got no recipes, though the docs say these are the server's table. `outside_world()` is now "a client with no player" (the title screen). The docs and signatures are unchanged; no new hook, no API bump. **Tested in the game** (offscreen, single player): a native mod's machine reads its recipes by type from a content mod (1,666 recipes of one type, in subfolders) and runs them on the server thread. A world data pack that replaces one of them by id is picked up by `/reload` while the machine runs. Before the fix the same machine found none (`native_recipes_of_type` empty while `recipes().custom` held the type). Note: recipes in subfolders of a content mod (`data/mymod/recipe/crusher/iron.json`) also need #5026 (open), which I merged locally for the test. **pr_ready** (`tools/pr_ready.py --quick`, against origin/main at c3905131b) | Check | Result | | --- | --- | | Scope | ✅ 1 file, +13 −3 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 495 passed | | rustfmt | ✅ | | clippy | ✅ | | tests: horizon-client | ✅ 1340 passed | | Parity | ➖ not run (--quick) | 🤖 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 06:11:33 +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#6088
No description provided.