[PR #3898] [MERGED] Client: load item model definitions from nested folders #5277

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3898
Author: @Bloodulon
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: pr/item-definitions


📝 Commits (1)

  • cdd3254 Load item definitions from nested folders

📊 Changes

1 file changed (+47 additions, -17 deletions)

View changed files

📝 crates/horizon-client/src/item_render.rs (+47 -17)

📄 Description

🤖 Opened by Bloodulon's AI agent (Qoder), not by Bloodulon personally.

What and why

A client item definition is addressed as namespace:path, and path may contain folders. ModelEngine relies on that: every NPC bone is a stack whose minecraft:item_model is modelengine:<model>/<bone>, defined at assets/modelengine/items/<model>/<bone>.json.

load_definitions only read the files at the top of assets/<ns>/items, so those definitions were never indexed. The stack fell back to minecraft:builtin/missing, whose sprite (minecraft:missingno) is not in the HUD atlas, and submit_quads drops quads whose sprite is unknown — the NPC submitted no geometry at all while its interaction hitbox stayed clickable.

The loader now walks items/**, as ParsedModels::load already does for models. Vanilla's own definitions are flat, so nothing changes for them; packs that use the folder form (ModelEngine, Nexo, hand-written definitions) now resolve.

Testing

  • New unit test item_definitions_load_from_nested_folders.
  • cargo +1.95 test -p horizon-client --lib: 673 passed.
  • In game with a ModelEngine/Nexo pack, /give @s paper[minecraft:item_model="modelengine:postman/head"] renders the model in hand; before the change the held item was invisible.

Same pattern elsewhere

While auditing for this class of bug: models, textures, font, advancement and loot_table already walk subfolders, but assets/<ns>/atlases, assets/<ns>/waypoint_style, assets/<ns>/equipment (also reads the minecraft namespace only), data/<ns>/trim_pattern/trim_material and data/<ns>/recipe still scan one level. Not touched here; left for follow-ups if packs address those with a slash.

  • Allow edits by maintainers

🤖 Generated with Qoder


🔄 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/3898 **Author:** [@Bloodulon](https://github.com/Bloodulon) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `pr/item-definitions` --- ### 📝 Commits (1) - [`cdd3254`](https://github.com/horizon-rust/horizon/commit/cdd3254dbbdac245d0417bc319bdae46861e1f8d) Load item definitions from nested folders ### 📊 Changes **1 file changed** (+47 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/item_render.rs` (+47 -17) </details> ### 📄 Description > 🤖 Opened by Bloodulon's AI agent (Qoder), not by Bloodulon personally. ## What and why A client item definition is addressed as `namespace:path`, and `path` may contain folders. ModelEngine relies on that: every NPC bone is a stack whose `minecraft:item_model` is `modelengine:<model>/<bone>`, defined at `assets/modelengine/items/<model>/<bone>.json`. `load_definitions` only read the files at the top of `assets/<ns>/items`, so those definitions were never indexed. The stack fell back to `minecraft:builtin/missing`, whose sprite (`minecraft:missingno`) is not in the HUD atlas, and `submit_quads` drops quads whose sprite is unknown — the NPC submitted no geometry at all while its interaction hitbox stayed clickable. The loader now walks `items/**`, as `ParsedModels::load` already does for models. Vanilla's own definitions are flat, so nothing changes for them; packs that use the folder form (ModelEngine, Nexo, hand-written definitions) now resolve. ## Testing - New unit test `item_definitions_load_from_nested_folders`. - `cargo +1.95 test -p horizon-client --lib`: 673 passed. - In game with a ModelEngine/Nexo pack, `/give @s paper[minecraft:item_model="modelengine:postman/head"]` renders the model in hand; before the change the held item was invisible. ## Same pattern elsewhere While auditing for this class of bug: `models`, `textures`, `font`, `advancement` and `loot_table` already walk subfolders, but `assets/<ns>/atlases`, `assets/<ns>/waypoint_style`, `assets/<ns>/equipment` (also reads the `minecraft` namespace only), `data/<ns>/trim_pattern`/`trim_material` and `data/<ns>/recipe` still scan one level. Not touched here; left for follow-ups if packs address those with a slash. - [x] Allow edits by maintainers 🤖 Generated with Qoder --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:11:27 +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#5277
No description provided.