[PR #530] [MERGED] Content mods in the resource root: template rows appended to every block table #2626

Closed
opened 2026-11-02 15:57:45 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: feat/mod-content-root


📝 Commits (2)

  • 746c888 horizon-mods: content mods (API 0.2), blocks and items declared from vanilla templates
  • 002cfcd Content mods in the resource root: template rows appended to every block table

📊 Changes

11 files changed (+1743 additions, -38 deletions)

View changed files

📝 Cargo.lock (+1 -0)
📝 crates/horizon-client/src/lib.rs (+1 -0)
➕ crates/horizon-client/src/mod_content.rs (+818 -0)
➕ crates/horizon-client/src/mod_content_tests.rs (+213 -0)
📝 crates/horizon-mods/Cargo.toml (+1 -0)
➕ crates/horizon-mods/src/content.rs (+557 -0)
📝 crates/horizon-mods/src/lib.rs (+2 -0)
📝 crates/horizon-mods/src/manifest.rs (+80 -30)
📝 crates/horizon-mods/src/runtime.rs (+15 -7)
📝 crates/horizon-mods/tests/sandbox.rs (+33 -1)
📝 docs/mods.md (+22 -0)

📄 Description

Stacked on #523. Second step of docs/modpacks.md "Registries 0.2": the blocks a content mod declares get rows in every table the game loads.

What it does

horizon_client::mod_content::resource_root(base, mods, cache) builds an overlay of the prepared resource root (symlinks to base, plus the rewritten tables) in cache/mod-content. Every block a content mod declares clones its vanilla template's rows, appended after vanilla's ids (mods, then blocks, in id order). Vanilla keeps every state id it had.

  • 13 JSON tables: facts.json, gameplay-facts.json (with the declared overrides: hardness, explosion resistance, light, friction, map colour, sounds, requires-tool), block-behaviours.json (item set to air with "item": false), model-states.json, render-definitions.json, landing-definitions.json, items.json (max stack size, rarity), command-registries.json, mob-data.json, worldgen/block_flags.json, worldgen/blocks/structure-blocks.json and both survival tables. Names, translation keys and state ids are renamed; the JSON keeps its key order.
  • 6 NBT tables: state lists, cached shape arrays and block compounds.
  • Tags: the mods' additions are merged into the tag files and the two tag bundles. A mod's "replace": true is refused.
  • With no content mod, the base root is used unchanged and nothing is built.

Proof

mod_content::tests::content_root_loads_with_every_table uses the real prepared root. It builds a mod with a full block, a 64-state door and a glass without an item, all from templates. Then it loads Assets, BlockFacts, Items, collisions, visibility, LightTables, MotionResources and worldgen's GeneratorData over the overlay, and checks three things:

  • the new ids, the overrides and that every door state matches its template;
  • that vanilla rows are untouched;
  • that the base root was only read.

Size

818 lines of code and 213 lines of tests. It is over the usual ~500, because the table rules only make sense together.

Checks

  • cargo fmt --all --check passes, and cargo clippy --workspace --all-targets -- -D warnings passes.
  • cargo test -p horizon-client --lib mod_content passes.
  • Local parity runs on the integration head of the stack. Results will follow in a comment.

🤖 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/530 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/16/2026 **Status:** ✅ Merged **Merged:** 10/16/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/mod-content-root` --- ### 📝 Commits (2) - [`746c888`](https://github.com/horizon-rust/horizon/commit/746c888cd3b85bfe27dbc15b292f0c62054300f6) horizon-mods: content mods (API 0.2), blocks and items declared from vanilla templates - [`002cfcd`](https://github.com/horizon-rust/horizon/commit/002cfcd8593dfc293b3ed9e07523bcfd0e0f3870) Content mods in the resource root: template rows appended to every block table ### 📊 Changes **11 files changed** (+1743 additions, -38 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+1 -0) 📝 `crates/horizon-client/src/lib.rs` (+1 -0) ➕ `crates/horizon-client/src/mod_content.rs` (+818 -0) ➕ `crates/horizon-client/src/mod_content_tests.rs` (+213 -0) 📝 `crates/horizon-mods/Cargo.toml` (+1 -0) ➕ `crates/horizon-mods/src/content.rs` (+557 -0) 📝 `crates/horizon-mods/src/lib.rs` (+2 -0) 📝 `crates/horizon-mods/src/manifest.rs` (+80 -30) 📝 `crates/horizon-mods/src/runtime.rs` (+15 -7) 📝 `crates/horizon-mods/tests/sandbox.rs` (+33 -1) 📝 `docs/mods.md` (+22 -0) </details> ### 📄 Description Stacked on #523. Second step of [docs/modpacks.md](../blob/main/docs/modpacks.md) "Registries 0.2": the blocks a content mod declares get rows in every table the game loads. ## What it does `horizon_client::mod_content::resource_root(base, mods, cache)` builds an overlay of the prepared resource root (symlinks to `base`, plus the rewritten tables) in `cache/mod-content`. Every block a content mod declares clones its vanilla template's rows, appended after vanilla's ids (mods, then blocks, in id order). Vanilla keeps every state id it had. - **13 JSON tables**: `facts.json`, `gameplay-facts.json` (with the declared overrides: hardness, explosion resistance, light, friction, map colour, sounds, requires-tool), `block-behaviours.json` (item set to air with `"item": false`), `model-states.json`, `render-definitions.json`, `landing-definitions.json`, `items.json` (max stack size, rarity), `command-registries.json`, `mob-data.json`, `worldgen/block_flags.json`, `worldgen/blocks/structure-blocks.json` and both survival tables. Names, translation keys and state ids are renamed; the JSON keeps its key order. - **6 NBT tables**: state lists, cached shape arrays and block compounds. - **Tags**: the mods' additions are merged into the tag files and the two tag bundles. A mod's `"replace": true` is refused. - With no content mod, the base root is used unchanged and nothing is built. ## Proof `mod_content::tests::content_root_loads_with_every_table` uses the real prepared root. It builds a mod with a full block, a 64-state door and a glass without an item, all from templates. Then it loads `Assets`, `BlockFacts`, `Items`, collisions, visibility, `LightTables`, `MotionResources` and worldgen's `GeneratorData` over the overlay, and checks three things: - the new ids, the overrides and that every door state matches its template; - that vanilla rows are untouched; - that the base root was only read. ## Size 818 lines of code and 213 lines of tests. It is over the usual ~500, because the table rules only make sense together. ## Checks - `cargo fmt --all --check` passes, and `cargo clippy --workspace --all-targets -- -D warnings` passes. - `cargo test -p horizon-client --lib mod_content` passes. - Local parity runs on the integration head of the stack. Results will follow in a comment. 🤖 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-02 15:57:45 +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#2626
No description provided.