[PR #531] [MERGED] Content mods in the game: loot, recipes, models, names and icons from mod namespaces #2627

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

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


📝 Commits (3)

  • 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
  • ac7b7f9 Content mods in the game: loot, recipes, models, names and icons from mod namespaces

📊 Changes

35 files changed (+2036 additions, -72 deletions)

View changed files

📝 Cargo.lock (+1 -0)
📝 crates/horizon-client/src/crafting.rs (+27 -12)
📝 crates/horizon-client/src/creative.rs (+14 -7)
📝 crates/horizon-client/src/game.rs (+5 -0)
📝 crates/horizon-client/src/game/mods.rs (+54 -0)
📝 crates/horizon-client/src/hud.rs (+4 -2)
📝 crates/horizon-client/src/items.rs (+28 -10)
📝 crates/horizon-client/src/lib.rs (+1 -0)
➕ crates/horizon-client/src/mod_content.rs (+857 -0)
➕ crates/horizon-client/src/mod_content_tests.rs (+218 -0)
📝 crates/horizon-client/src/models.rs (+1 -1)
📝 crates/horizon-client/src/models/catalog.rs (+4 -2)
➕ crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/blockstates/ruby_block.json (+7 -0)
➕ crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/items/ruby.json (+6 -0)
➕ crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/items/ruby_block.json (+6 -0)
➕ crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/lang/en_us.json (+4 -0)
➕ crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/models/block/ruby_block.json (+6 -0)
➕ crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/models/item/ruby.json (+6 -0)
➕ crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/textures/block/ruby_block.png (+0 -0)
➕ crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/textures/item/ruby.png (+0 -0)

...and 15 more files

📄 Description

Stacked on #530 (which is stacked on #523). The game now loads content mods. With this PR, a code-free .hmod adds blocks and items you can place, mine, craft and loot.

What it does

  • Startup. game.rs builds the content root from the enabled mods that have registries (installed ones and --dev-mod), right after the resource-pack root. It logs Horizon: content from N mod(s).
  • Mod namespaces. The root's marker file lists the content namespaces. Loaders that only read minecraft now read those namespaces too:
    • block loot tables (<ns>:blocks/<path>);
    • recipes, under <ns>:<name>;
    • blockstates, through the models catalog;
    • language files and item names;
    • the HUD atlas's item sprites. A non-vanilla texture was skipped as "already packed".
  • Commands. command-registries.json lists the new ids, so /give and /setblock accept them.
  • Fallback. A block without its own blockstate takes its template's, so every state has a model.
  • Example. crates/horizon-mod-sdk/examples/ruby-content is a folder content mod. It has a ruby block (iron block template, hardness 4, light 3, amethyst sounds) and a ruby item (diamond template, uncommon). It also has shaped and shapeless recipes, a loot table, pickaxe and iron-tool tags, models, textures and names. Try it with horizon-client --dev-mod crates/horizon-mod-sdk/examples/ruby-content.

Proof

I tested it in game with a release build, offscreen, driven by horizon-ctl, in survival:

  • /setblock ~ ~ ~ ruby:ruby_block renders the mod's texture.

  • /give @s ruby:ruby answers "Gave 1 [Ruby]", and the ruby block shows as "[Block of Ruby]".

  • Mining time follows hardness 4 against iron's 5:

    Tool Ruby block Iron block
    Hand 404 ticks 506 ticks
    Diamond pickaxe 20 ticks 24 ticks

    Mined by hand, it drops nothing (requires-tool). Mined with a pickaxe, it drops itself through the mod's loot table.

  • Crafting a block of ruby in the 2×2 grid gives 9 rubies (the shapeless recipe).

  • Inventory icons draw from the mod's textures.

The Rust test now also checks the blockstate fallback.

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: 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/531 **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-game` --- ### 📝 Commits (3) - [`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 - [`ac7b7f9`](https://github.com/horizon-rust/horizon/commit/ac7b7f98c0292ead567c90b4553bdbd911128329) Content mods in the game: loot, recipes, models, names and icons from mod namespaces ### 📊 Changes **35 files changed** (+2036 additions, -72 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+1 -0) 📝 `crates/horizon-client/src/crafting.rs` (+27 -12) 📝 `crates/horizon-client/src/creative.rs` (+14 -7) 📝 `crates/horizon-client/src/game.rs` (+5 -0) 📝 `crates/horizon-client/src/game/mods.rs` (+54 -0) 📝 `crates/horizon-client/src/hud.rs` (+4 -2) 📝 `crates/horizon-client/src/items.rs` (+28 -10) 📝 `crates/horizon-client/src/lib.rs` (+1 -0) ➕ `crates/horizon-client/src/mod_content.rs` (+857 -0) ➕ `crates/horizon-client/src/mod_content_tests.rs` (+218 -0) 📝 `crates/horizon-client/src/models.rs` (+1 -1) 📝 `crates/horizon-client/src/models/catalog.rs` (+4 -2) ➕ `crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/blockstates/ruby_block.json` (+7 -0) ➕ `crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/items/ruby.json` (+6 -0) ➕ `crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/items/ruby_block.json` (+6 -0) ➕ `crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/lang/en_us.json` (+4 -0) ➕ `crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/models/block/ruby_block.json` (+6 -0) ➕ `crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/models/item/ruby.json` (+6 -0) ➕ `crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/textures/block/ruby_block.png` (+0 -0) ➕ `crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/textures/item/ruby.png` (+0 -0) _...and 15 more files_ </details> ### 📄 Description Stacked on #530 (which is stacked on #523). The game now loads content mods. With this PR, a code-free `.hmod` adds blocks and items you can place, mine, craft and loot. ## What it does - **Startup.** `game.rs` builds the content root from the enabled mods that have `registries` (installed ones and `--dev-mod`), right after the resource-pack root. It logs `Horizon: content from N mod(s)`. - **Mod namespaces.** The root's marker file lists the content namespaces. Loaders that only read `minecraft` now read those namespaces too: - block loot tables (`<ns>:blocks/<path>`); - recipes, under `<ns>:<name>`; - blockstates, through the models catalog; - language files and item names; - the HUD atlas's item sprites. A non-vanilla texture was skipped as "already packed". - **Commands.** `command-registries.json` lists the new ids, so `/give` and `/setblock` accept them. - **Fallback.** A block without its own blockstate takes its template's, so every state has a model. - **Example.** `crates/horizon-mod-sdk/examples/ruby-content` is a folder content mod. It has a ruby block (iron block template, hardness 4, light 3, amethyst sounds) and a ruby item (diamond template, uncommon). It also has shaped and shapeless recipes, a loot table, pickaxe and iron-tool tags, models, textures and names. Try it with `horizon-client --dev-mod crates/horizon-mod-sdk/examples/ruby-content`. ## Proof I tested it in game with a release build, offscreen, driven by `horizon-ctl`, in survival: - `/setblock ~ ~ ~ ruby:ruby_block` renders the mod's texture. - `/give @s ruby:ruby` answers "Gave 1 [Ruby]", and the ruby block shows as "[Block of Ruby]". - **Mining time follows hardness 4 against iron's 5**: | Tool | Ruby block | Iron block | |---|---|---| | Hand | 404 ticks | 506 ticks | | Diamond pickaxe | 20 ticks | 24 ticks | Mined by hand, it drops nothing (requires-tool). Mined with a pickaxe, it drops itself through the mod's loot table. - Crafting a block of ruby in the 2×2 grid gives 9 rubies (the shapeless recipe). - Inventory icons draw from the mod's textures. The Rust test now also checks the blockstate fallback. ## 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: 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#2627
No description provided.