[PR #5439] [MERGED] Recipes answer NeoForge's load conditions #6288

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5439
Author: @Qwerner88880
Created: 10/31/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: hooks-conditions


📝 Commits (4)

  • 6174667 Recipes answer NeoForge's load conditions
  • 3379d00 Load conditions: mod IDs, not namespaces; unknown fails closed; the overlay replaces before the gate
  • 42e5a2f Load conditions: an unknown kind nested in the tree leaves the file out
  • 88e4e2b Merge main into #5439

📊 Changes

9 files changed (+334 additions, -12 deletions)

View changed files

📝 crates/horizon-client-render/src/brewing.rs (+15 -0)
📝 crates/horizon-client/src/crafting.rs (+79 -0)
📝 crates/horizon-client/src/mod_content.rs (+5 -0)
📝 crates/horizon-client/src/recipe_book.rs (+34 -12)
📝 crates/horizon-client/src/stations.rs (+15 -0)
📝 crates/horizon-items/src/content_namespaces.rs (+14 -0)
➕ crates/horizon-world/src/conditions.rs (+161 -0)
📝 crates/horizon-world/src/lib.rs (+1 -0)
📝 docs/native-mods.md (+10 -0)

📄 Description

🤖 Opened by Qwerner88880's AI agent (ZCode, GLM-5.3), not by Qwerner88880 personally.

What and why

Fixes #5368. Part of #4953 ("More content registration") and #3911 (Mods).

A data file that carries NeoForge's neoforge:conditions now loads only when every condition holds, and is silently absent otherwise, as NeoForge's ICondition leaves it out of the manager. Ported modpacks already ship such recipes verbatim (the carry step keeps them on purpose), and today the game loads them blind — a cross-mod recipe lands even when the mod it needs is off, or the pack's own gating is ignored.

  • The gate (horizon_world::conditions::conditions_hold): the neoforge:conditions array, every entry must hold; neoforge:mod_loaded (its modid asked against the content root's namespaces — minecraft always, the content mods that are on), neoforge:true, neoforge:not, neoforge:and, neoforge:or; an unknown condition type leaves the file out, so a future shape fails closed. The semantics are the porting tool's own conditions_pass (horizon-port-pack's lithostitched), now answering at load time.
  • Where it answers: the recipe loaders — crafting's three kinds and the mods' own types (crafting.rs), the stations (stations.rs, files and packs), brewing (brewing.rs, both), and the recipe book (recipe_book.rs, both) — so the manager and the book agree. No loader signature changes: each already had the root, whose namespaces answer mod_loaded.
  • Not yet: tags, loot tables and advancements (the same gate fits them; one PR each if wanted), and native mods — they carry their data in code, not files.

Kind

  • parity: Horizon now does what vanilla (NeoForge) does
  • bug: a crash or a breakage
  • feature: something new for players
  • tooling
  • docs

Vanilla reference

NeoForge's data conditions (ICondition, neoforge:conditions) — public docs; the evaluator mirrors horizon-port-pack's conditions_pass, written for the pack porter from the same source.

Other projects' code

none

Tests

Unit: the gate's shapes (no conditions loads; mod_loaded follows the answer and minecraft always holds; not/and/or combine; one failing entry fails the file; an unknown type fails closed) in conditions.rs, and a loader test in crafting.rs: a temp root with a mod marker and three recipes — on a loaded mod, on an absent one, not on an absent one — loads the two it should from its own files and a pack's gated file answers the same gate.

Live, on this branch (HEAD 617466720): a dedicated server with two horizon-ctl --offscreen clients and a content mod whose condmod:crusher recipes carry the three conditions; a throwaway bundle asks native_recipes_of_type what the manager holds. RESULT: 6 checks, 0 failures — the gated-on-loaded recipe is there, the gated-on-absent one is not, not holds, and a /reload re-answers the gate the same way.

Self-check

pr_ready (tools/pr_ready.py --quick on DESKTOP-H7P5E7K, against origin/main at c0df3d782, 3 min 28 s)

Check Result
Scope ✅ 7 files, +243 −1
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 505 passed (55 s)
rustfmt ✅ (8 s)
clippy ✅ (55 s)
tests: horizon-client, horizon-client-render, horizon-world ❌ 1046 passed, 1 failed (1 min 22 s)
doc tests ✅ 0 passed (6 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 ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The one red there, title_screen_keyboard_navigation_and_activation, fails identically on pristine main (#5436); everything else is green.

🤖 Generated with ZCode (GLM-5.3)


🔄 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/5439 **Author:** [@Qwerner88880](https://github.com/Qwerner88880) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `hooks-conditions` --- ### 📝 Commits (4) - [`6174667`](https://github.com/horizon-rust/horizon/commit/617466720ae31e8947bf3ebb987b2326015dd798) Recipes answer NeoForge's load conditions - [`3379d00`](https://github.com/horizon-rust/horizon/commit/3379d00ae0dac0695a56d8d7798070b7f8a937dd) Load conditions: mod IDs, not namespaces; unknown fails closed; the overlay replaces before the gate - [`42e5a2f`](https://github.com/horizon-rust/horizon/commit/42e5a2fb8e9b64bf5fbb1034e592456d71f8c260) Load conditions: an unknown kind nested in the tree leaves the file out - [`88e4e2b`](https://github.com/horizon-rust/horizon/commit/88e4e2b8475634ed95ee988e622c01cd6fb1d7a3) Merge main into #5439 ### 📊 Changes **9 files changed** (+334 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/brewing.rs` (+15 -0) 📝 `crates/horizon-client/src/crafting.rs` (+79 -0) 📝 `crates/horizon-client/src/mod_content.rs` (+5 -0) 📝 `crates/horizon-client/src/recipe_book.rs` (+34 -12) 📝 `crates/horizon-client/src/stations.rs` (+15 -0) 📝 `crates/horizon-items/src/content_namespaces.rs` (+14 -0) ➕ `crates/horizon-world/src/conditions.rs` (+161 -0) 📝 `crates/horizon-world/src/lib.rs` (+1 -0) 📝 `docs/native-mods.md` (+10 -0) </details> ### 📄 Description > 🤖 Opened by Qwerner88880's AI agent (ZCode, GLM-5.3), not by Qwerner88880 personally. ## What and why Fixes #5368. Part of #4953 ("More content registration") and #3911 (Mods). A data file that carries NeoForge's `neoforge:conditions` now loads only when every condition holds, and is silently absent otherwise, as NeoForge's `ICondition` leaves it out of the manager. Ported modpacks already ship such recipes verbatim (the carry step keeps them on purpose), and today the game loads them blind — a cross-mod recipe lands even when the mod it needs is off, or the pack's own gating is ignored. - **The gate** (`horizon_world::conditions::conditions_hold`): the `neoforge:conditions` array, every entry must hold; `neoforge:mod_loaded` (its `modid` asked against the content root's namespaces — `minecraft` always, the content mods that are on), `neoforge:true`, `neoforge:not`, `neoforge:and`, `neoforge:or`; an unknown condition type leaves the file out, so a future shape fails closed. The semantics are the porting tool's own `conditions_pass` (`horizon-port-pack`'s lithostitched), now answering at load time. - **Where it answers**: the recipe loaders — crafting's three kinds and the mods' own types (`crafting.rs`), the stations (`stations.rs`, files and packs), brewing (`brewing.rs`, both), and the recipe book (`recipe_book.rs`, both) — so the manager and the book agree. No loader signature changes: each already had the root, whose namespaces answer `mod_loaded`. - **Not yet**: tags, loot tables and advancements (the same gate fits them; one PR each if wanted), and native mods — they carry their data in code, not files. ## Kind - [x] parity: Horizon now does what vanilla (NeoForge) does - [ ] bug: a crash or a breakage - [ ] feature: something new for players - [ ] tooling - [ ] docs ## Vanilla reference NeoForge's data conditions (`ICondition`, `neoforge:conditions`) — public docs; the evaluator mirrors `horizon-port-pack`'s `conditions_pass`, written for the pack porter from the same source. ## Other projects' code none ## Tests **Unit:** the gate's shapes (no conditions loads; `mod_loaded` follows the answer and `minecraft` always holds; `not`/`and`/`or` combine; one failing entry fails the file; an unknown type fails closed) in `conditions.rs`, and a loader test in `crafting.rs`: a temp root with a mod marker and three recipes — on a loaded mod, on an absent one, `not` on an absent one — loads the two it should from its own files and a pack's gated file answers the same gate. **Live, on this branch (HEAD `617466720`):** a dedicated server with two `horizon-ctl --offscreen` clients and a content mod whose `condmod:crusher` recipes carry the three conditions; a throwaway bundle asks `native_recipes_of_type` what the manager holds. RESULT: 6 checks, 0 failures — the gated-on-loaded recipe is there, the gated-on-absent one is not, `not` holds, and a `/reload` re-answers the gate the same way. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on DESKTOP-H7P5E7K, against origin/main at c0df3d782, 3 min 28 s) | Check | Result | | --- | --- | | Scope | ✅ 7 files, +243 −1 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 505 passed (55 s) | | rustfmt | ✅ (8 s) | | clippy | ✅ (55 s) | | tests: horizon-client, horizon-client-render, horizon-world | ❌ 1046 passed, 1 failed (1 min 22 s) | | doc tests | ✅ 0 passed (6 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 | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The one red there, `title_screen_keyboard_navigation_and_activation`, fails identically on pristine main (#5436); everything else is green. 🤖 Generated with ZCode (GLM-5.3) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:17:48 +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#6288
No description provided.