[PR #6442] [MERGED] A file-declared item may name a code-declared item as its crafting remainder #6875

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6442
Author: @xFedeT
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/code-item-remainder


📝 Commits (3)

  • 6e79752 A file-declared item may name a code-declared item as its crafting remainder
  • f798193 A refused code declaration leaves out only the content mod whose file item needed it
  • a1fac8d A remainder that is the mod's own block item is not dangling

📊 Changes

4 files changed (+139 additions, -4 deletions)

View changed files

📝 crates/horizon-client/src/game/mods.rs (+13 -1)
📝 crates/horizon-client/src/mod_content.rs (+38 -0)
📝 crates/horizon-client/src/mod_content_tests.rs (+47 -0)
📝 crates/horizon-mods/src/content.rs (+41 -3)

📄 Description

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

Fixes #6400

What was wrong

game/mods.rs reads each content mod's files with Content::read, whose remainder check (horizon-mods/src/content.rs) only knows the items in those files, and collects the native mods' code declarations afterwards. A file-declared item whose crafting_remainder named an item the same mod declares in code (machine_sample:wrench) failed the check, and the whole content mod (its other blocks, items, assets and lang) was refused.

What changes

Content::read_declaring(path, manifest, declared): the remainder check also accepts the ids in declared; Content::read is read_declaring with none. mods.rs passes the ids native_items declares in the mod's own namespace, which it already has before reading the files (native_declared() is built once).

Verification

a_file_item_may_leave_a_code_declared_item_as_its_remainder: the same file is refused with no declared ids and read with ruby:wrench declared. cargo test -p horizon-mods remainder tests pass; clippy and rustfmt are clean for the changed files (the only clippy error is the existing needless_borrow in horizon-world). The issue's in-game route (the horizon-machine-sample branch) was not run.

Not done

The reverse direction already worked (the check for code-declared items knows the file ones), so it is unchanged.

🤖 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/6442 **Author:** [@xFedeT](https://github.com/xFedeT) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/code-item-remainder` --- ### 📝 Commits (3) - [`6e79752`](https://github.com/horizon-rust/horizon/commit/6e79752f94c52a0f77a6fd75d6ea3f1c63f06414) A file-declared item may name a code-declared item as its crafting remainder - [`f798193`](https://github.com/horizon-rust/horizon/commit/f798193428170621e161cb48eee7ced08eaf6848) A refused code declaration leaves out only the content mod whose file item needed it - [`a1fac8d`](https://github.com/horizon-rust/horizon/commit/a1fac8df391a75e5e73d4f9534b48217312b1804) A remainder that is the mod's own block item is not dangling ### 📊 Changes **4 files changed** (+139 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/mods.rs` (+13 -1) 📝 `crates/horizon-client/src/mod_content.rs` (+38 -0) 📝 `crates/horizon-client/src/mod_content_tests.rs` (+47 -0) 📝 `crates/horizon-mods/src/content.rs` (+41 -3) </details> ### 📄 Description > 🤖 Opened by xFedeT's AI agent (Claude Code, Sonnet 5.5), not by xFedeT personally. Fixes #6400 ## What was wrong `game/mods.rs` reads each content mod's files with `Content::read`, whose remainder check (`horizon-mods/src/content.rs`) only knows the items in those files, and collects the native mods' code declarations afterwards. A file-declared item whose `crafting_remainder` named an item the same mod declares in code (`machine_sample:wrench`) failed the check, and the whole content mod (its other blocks, items, assets and lang) was refused. ## What changes `Content::read_declaring(path, manifest, declared)`: the remainder check also accepts the ids in `declared`; `Content::read` is `read_declaring` with none. `mods.rs` passes the ids `native_items` declares in the mod's own namespace, which it already has before reading the files (`native_declared()` is built once). ## Verification `a_file_item_may_leave_a_code_declared_item_as_its_remainder`: the same file is refused with no declared ids and read with `ruby:wrench` declared. `cargo test -p horizon-mods` remainder tests pass; clippy and rustfmt are clean for the changed files (the only clippy error is the existing `needless_borrow` in `horizon-world`). The issue's in-game route (the horizon-machine-sample branch) was not run. ## Not done The reverse direction already worked (the check for code-declared items knows the file ones), so it is unchanged. 🤖 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:28:30 +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#6875
No description provided.