[PR #1240] [MERGED] Mod content: give mod items and blocks network ids, so they don't travel as air #3446

Closed
opened 2026-11-03 04:09:35 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/mod-item-network-ids


📝 Commits (2)

  • 240e761 Mod content: give mod items and blocks network ids, so they don't travel as air
  • 05497dd Merge origin/main into fix/mod-item-network-ids

📊 Changes

2 files changed (+62 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/mod_content.rs (+33 -1)
📝 crates/horizon-client/src/mod_content_tests.rs (+29 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Found by the mod browser's end-to-end run (brief modbrowser-java-1, step 3): a Java mod's item, given or crafted, arrived on the client as air.

Why

The client and the in-process server map item and block network ids through registries.json. The content root built for content mods (mod_content::resource_root) adds the mods' items and blocks to every table except that one, so mcwfences:acacia_hedge had no network id: the server sent it, the client read it as air.

What

registries.json joins the JSON tables the content root rewrites (14 now). The mods' new items (items[].rename.to) and blocks (blocks[].decl.id) are appended to minecraft:item and minecraft:block, with protocol ids from the highest vanilla one + 1, in the order the plan already uses for the other tables. Vanilla ids don't move, and a game with no content mod never builds a content root, so it is unchanged.

Measured

In game (Mac mini, offscreen, horizon-ctl) with Macaw's Fences ported by the launcher: the hedge is given, held, placed, and its recipe crafts 4 into the inventory (tools/mod_browser_harness.py, in the harness PR). Before: the held item was air. World load with the mod 7.3 s against 5.4 s without (the content root's first build; unchanged by this PR, which adds one table).

Self-check

  • cargo fmt, cargo clippy -p horizon-client --all-targets -- -D warnings: clean
  • cargo test -p horizon-client mod_content: 16 passed; content_root_loads_with_every_table now checks the mod item's and block's network ids
  • tools/parity.py --changed origin/main: 102 harnesses depend on horizon-client files. None runs with a content mod (resource_root returns the vanilla root when no mod has content), so none was rerun.

Overlap

#1191 (perf/mod-content-build) also edits mod_content.rs, in the loop over JSON_TABLES. This PR only adds one name to that list and one match arm in Plan::json, so either merges after the other with at most a one-line conflict.

Needs Ludovic

Nothing.

🤖 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/1240 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/22/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/mod-item-network-ids` --- ### 📝 Commits (2) - [`240e761`](https://github.com/horizon-rust/horizon/commit/240e76160bfcb0bcb1f2bfc537f6317aed14d7f0) Mod content: give mod items and blocks network ids, so they don't travel as air - [`05497dd`](https://github.com/horizon-rust/horizon/commit/05497ddd104a71f3d1ace1d2944d73480c342d77) Merge origin/main into fix/mod-item-network-ids ### 📊 Changes **2 files changed** (+62 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mod_content.rs` (+33 -1) 📝 `crates/horizon-client/src/mod_content_tests.rs` (+29 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Found by the mod browser's end-to-end run (brief modbrowser-java-1, step 3): a Java mod's item, given or crafted, arrived on the client as air. ## Why The client and the in-process server map item and block network ids through `registries.json`. The content root built for content mods (`mod_content::resource_root`) adds the mods' items and blocks to every table except that one, so `mcwfences:acacia_hedge` had no network id: the server sent it, the client read it as air. ## What `registries.json` joins the JSON tables the content root rewrites (14 now). The mods' new items (`items[].rename.to`) and blocks (`blocks[].decl.id`) are appended to `minecraft:item` and `minecraft:block`, with protocol ids from the highest vanilla one + 1, in the order the plan already uses for the other tables. Vanilla ids don't move, and a game with no content mod never builds a content root, so it is unchanged. ## Measured In game (Mac mini, offscreen, horizon-ctl) with Macaw's Fences ported by the launcher: the hedge is given, held, placed, and its recipe crafts 4 into the inventory (`tools/mod_browser_harness.py`, in the harness PR). Before: the held item was air. World load with the mod 7.3 s against 5.4 s without (the content root's first build; unchanged by this PR, which adds one table). ## Self-check - `cargo fmt`, `cargo clippy -p horizon-client --all-targets -- -D warnings`: clean - `cargo test -p horizon-client mod_content`: 16 passed; `content_root_loads_with_every_table` now checks the mod item's and block's network ids - `tools/parity.py --changed origin/main`: 102 harnesses depend on horizon-client files. None runs with a content mod (`resource_root` returns the vanilla root when no mod has content), so none was rerun. ## Overlap #1191 (perf/mod-content-build) also edits `mod_content.rs`, in the loop over `JSON_TABLES`. This PR only adds one name to that list and one match arm in `Plan::json`, so either merges after the other with at most a one-line conflict. ## Needs Ludovic Nothing. 🤖 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 04:09:35 +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#3446
No description provided.