[PR #2215] [MERGED] Split horizon-items out of horizon-client #4109

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

📋 Pull Request Information

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

Base: main ← Head: refactor/horizon-items


📝 Commits (10+)

  • 27d750f Split horizon-items out of horizon-client
  • ca119bb Merge origin/main into refactor/horizon-items
  • f56bf1b Merge remote-tracking branch 'origin/main' into refactor/horizon-items
  • 775e5b1 horizon-items: tests load prepared items without the client's Assets
  • 3c94b54 Merge refactor/horizon-command (with main) into refactor/horizon-items
  • a07c6d5 horizon-items: item_name reads name_text from horizon-client-core
  • fc8e505 Merge refactor/horizon-command (with main and #2316) into refactor/horizon-items
  • 5f73d0d Merge refactor/horizon-command (with main) into refactor/horizon-items
  • 2f489f5 Merge origin/main (with #2160) into refactor/horizon-items
  • 75bcbce Merge origin/main into refactor/horizon-items

📊 Changes

39 files changed (+512 additions, -412 deletions)

View changed files

📝 AGENTS.md (+3 -2)
📝 Cargo.lock (+12 -0)
📝 Cargo.toml (+1 -0)
📝 crates/horizon-client-core/src/component.rs (+10 -0)
📝 crates/horizon-client-core/src/lib.rs (+1 -0)
➕ crates/horizon-client-core/src/nbt_value.rs (+24 -0)
📝 crates/horizon-client/Cargo.toml (+2 -0)
📝 crates/horizon-client/examples/gameplay_decode_profile.rs (+1 -1)
📝 crates/horizon-client/src/assets.rs (+78 -0)
📝 crates/horizon-client/src/banner.rs (+1 -53)
📝 crates/horizon-client/src/entity_nbt.rs (+1 -9)
📝 crates/horizon-client/src/first_person.rs (+1 -12)
📝 crates/horizon-client/src/lib.rs (+7 -7)
📝 crates/horizon-client/src/mod_content.rs (+2 -25)
📝 crates/horizon-client/src/particles.rs (+33 -89)
📝 crates/horizon-client/src/save.rs (+5 -77)
➕ crates/horizon-items/Cargo.toml (+21 -0)
➕ crates/horizon-items/src/banner_layer.rs (+56 -0)
📝 crates/horizon-items/src/blocks.rs (+0 -0)
📝 crates/horizon-items/src/blocks/decode.rs (+0 -0)

...and 19 more files

📄 Description

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

Second slice of splitting horizon-client into crates, after #2160 (merged). A pure move: renames plus mechanical path fixes, no logic change.

What moves

  • horizon-items (~6.6k lines): blocks (+ blocks/decode.rs), items, item_data, enchant, cooldowns, bundle, random_sequences.
  • Items they need, moved unchanged out of lib modules that sit in the big cycle: the firework types (particles.rs), BannerLayer and its NBT helpers (banner.rs), the ItemStack NBT codec (save.rs), consumable_animation (first_person.rs), the content-namespace helpers (mod_content.rs). save's NBT value helpers (string, text, number) and name_text go to horizon-client-core.
  • horizon-client re-exports every module and item under its old path, so no caller changes.
  • mod_content stays in the client: its tests load the whole client. Two test helpers used by client tests (Items::for_tests, enchant::tests) sit behind a test-support feature that the client enables as a dev-dependency. One items test that loads the client's Assets moved to assets.rs. particles.rs's test module moved to the end of the file (clippy items_after_test_module once the firework types left).
  • Docs: AGENTS.md's crate table, docs/architecture.md. Tools: five harness source lists (creative_mining's arrived from main later) and one example's #[path].

Numbers (ThinkPad, idle, -j3, --no-default-features; base = #2160's branch)

base split
edit items.rs, then run its unit tests 8.1 s (-p horizon-client --lib items::) 1.0 s (-p horizon-items)
one-line edit, fast build: mobs/ai.rs 10.2 s 9.7 s
one-line edit, fast build: items.rs ~10-11 s 12.0 s

Same picture as #2160: the gain is the per-crate test loop. A lib edit gets a little cheaper as the lib shrinks. An edit in a lower crate costs ~1-2 s more on the full build (that crate, then the lib, then the bin), and saves ~7 s on its own test loop.

Merged since: #2037 and #2038

Main is merged in. #2037's loot tests and #2038's bundle tooltip tests load the prepared items; they stay in horizon-items through a test-only items::prepared_items() that reads facts.json and the block facts directly, as the client's Assets::load does (no change for their authors). #1702 (already conflicting) will need the same for its item_data.rs tests.

Checks

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 1e5ee00bc, 10 min 37 s)

Check Result
Scope ⚠️ 39 files, +508 −410; 894 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ changes with a Cargo.toml
Public tree ✅
Python tests ✅ 331 passed (23 s)
rustfmt ✅ after 8648470c4 (the merged read_text line, reformatted; cargo fmt --all -- --check clean)
clippy ✅ (1 min 8 s)
tests: workspace ✅ 2290 passed (5 min 37 s)
doc tests ✅ 2 passed (30 s)
content root tests ✅ 5 passed (2 min 7 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ✅ (1 s)
launcher clippy ✅ (14 s)
launcher tests ✅ 193 passed (33 s)
Parity ➖ 347 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 335 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Main's item_name (d983ef89b) now reads name_text from horizon-client-core, where it moved. Parity: Cargo.lock changes, so CI runs all harnesses.

🤖 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/2215 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `refactor/horizon-items` --- ### 📝 Commits (10+) - [`27d750f`](https://github.com/horizon-rust/horizon/commit/27d750f1c9367ef8c66ca17752c1a21f284abdca) Split horizon-items out of horizon-client - [`ca119bb`](https://github.com/horizon-rust/horizon/commit/ca119bb069bf93afff497354c73a743f236d6499) Merge origin/main into refactor/horizon-items - [`f56bf1b`](https://github.com/horizon-rust/horizon/commit/f56bf1ba382c8f66fcd387d676ad0daf224e311b) Merge remote-tracking branch 'origin/main' into refactor/horizon-items - [`775e5b1`](https://github.com/horizon-rust/horizon/commit/775e5b19cb399f62c446745d22df950b2bf31f04) horizon-items: tests load prepared items without the client's Assets - [`3c94b54`](https://github.com/horizon-rust/horizon/commit/3c94b5441ec509c398a7ff7c4a175d9bd0a8c3a0) Merge refactor/horizon-command (with main) into refactor/horizon-items - [`a07c6d5`](https://github.com/horizon-rust/horizon/commit/a07c6d57dc5aac19f65730aa5b01579cf54f4e62) horizon-items: item_name reads name_text from horizon-client-core - [`fc8e505`](https://github.com/horizon-rust/horizon/commit/fc8e505c9567332bd6062cfeb50f4c7f6f528e99) Merge refactor/horizon-command (with main and #2316) into refactor/horizon-items - [`5f73d0d`](https://github.com/horizon-rust/horizon/commit/5f73d0d02d6faa8611e1148d239da3813407a802) Merge refactor/horizon-command (with main) into refactor/horizon-items - [`2f489f5`](https://github.com/horizon-rust/horizon/commit/2f489f54c54be2956ab1517aecc8b4587e23eaec) Merge origin/main (with #2160) into refactor/horizon-items - [`75bcbce`](https://github.com/horizon-rust/horizon/commit/75bcbce441d3ae8cb3af78500b5c7ac7e882ef02) Merge origin/main into refactor/horizon-items ### 📊 Changes **39 files changed** (+512 additions, -412 deletions) <details> <summary>View changed files</summary> 📝 `AGENTS.md` (+3 -2) 📝 `Cargo.lock` (+12 -0) 📝 `Cargo.toml` (+1 -0) 📝 `crates/horizon-client-core/src/component.rs` (+10 -0) 📝 `crates/horizon-client-core/src/lib.rs` (+1 -0) ➕ `crates/horizon-client-core/src/nbt_value.rs` (+24 -0) 📝 `crates/horizon-client/Cargo.toml` (+2 -0) 📝 `crates/horizon-client/examples/gameplay_decode_profile.rs` (+1 -1) 📝 `crates/horizon-client/src/assets.rs` (+78 -0) 📝 `crates/horizon-client/src/banner.rs` (+1 -53) 📝 `crates/horizon-client/src/entity_nbt.rs` (+1 -9) 📝 `crates/horizon-client/src/first_person.rs` (+1 -12) 📝 `crates/horizon-client/src/lib.rs` (+7 -7) 📝 `crates/horizon-client/src/mod_content.rs` (+2 -25) 📝 `crates/horizon-client/src/particles.rs` (+33 -89) 📝 `crates/horizon-client/src/save.rs` (+5 -77) ➕ `crates/horizon-items/Cargo.toml` (+21 -0) ➕ `crates/horizon-items/src/banner_layer.rs` (+56 -0) 📝 `crates/horizon-items/src/blocks.rs` (+0 -0) 📝 `crates/horizon-items/src/blocks/decode.rs` (+0 -0) _...and 19 more files_ </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Second slice of splitting `horizon-client` into crates, after #2160 (merged). A **pure move**: renames plus mechanical path fixes, no logic change. ## What moves - **`horizon-items`** (~6.6k lines): `blocks` (+ `blocks/decode.rs`), `items`, `item_data`, `enchant`, `cooldowns`, `bundle`, `random_sequences`. - Items they need, moved unchanged out of lib modules that sit in the big cycle: the firework types (particles.rs), `BannerLayer` and its NBT helpers (banner.rs), the `ItemStack` NBT codec (save.rs), `consumable_animation` (first_person.rs), the content-namespace helpers (mod_content.rs). save's NBT value helpers (`string`, `text`, `number`) and `name_text` go to `horizon-client-core`. - `horizon-client` re-exports every module and item under its old path, so no caller changes. - `mod_content` stays in the client: its tests load the whole client. Two test helpers used by client tests (`Items::for_tests`, `enchant::tests`) sit behind a `test-support` feature that the client enables as a dev-dependency. One items test that loads the client's `Assets` moved to assets.rs. particles.rs's test module moved to the end of the file (clippy `items_after_test_module` once the firework types left). - Docs: AGENTS.md's crate table, docs/architecture.md. Tools: five harness source lists (creative_mining's arrived from main later) and one example's `#[path]`. ## Numbers (ThinkPad, idle, `-j3`, `--no-default-features`; base = #2160's branch) | | base | split | |---|---|---| | edit items.rs, then run its unit tests | 8.1 s (`-p horizon-client --lib items::`) | **1.0 s** (`-p horizon-items`) | | one-line edit, fast build: mobs/ai.rs | 10.2 s | 9.7 s | | one-line edit, fast build: items.rs | ~10-11 s | 12.0 s | Same picture as #2160: the gain is the per-crate test loop. A lib edit gets a little cheaper as the lib shrinks. An edit in a lower crate costs ~1-2 s more on the full build (that crate, then the lib, then the bin), and saves ~7 s on its own test loop. ## Merged since: #2037 and #2038 Main is merged in. #2037's loot tests and #2038's bundle tooltip tests load the prepared items; they stay in horizon-items through a test-only `items::prepared_items()` that reads `facts.json` and the block facts directly, as the client's `Assets::load` does (no change for their authors). #1702 (already conflicting) will need the same for its `item_data.rs` tests. ## Checks **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 1e5ee00bc, 10 min 37 s) | Check | Result | | --- | --- | | Scope | ⚠️ 39 files, +508 −410; 894 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ changes with a Cargo.toml | | Public tree | ✅ | | Python tests | ✅ 331 passed (23 s) | | rustfmt | ✅ after 8648470c4 (the merged `read_text` line, reformatted; `cargo fmt --all -- --check` clean) | | clippy | ✅ (1 min 8 s) | | tests: workspace | ✅ 2290 passed (5 min 37 s) | | doc tests | ✅ 2 passed (30 s) | | content root tests | ✅ 5 passed (2 min 7 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ✅ (1 s) | | launcher clippy | ✅ (14 s) | | launcher tests | ✅ 193 passed (33 s) | | Parity | ➖ 347 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 335 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Main's `item_name` (d983ef89b) now reads `name_text` from horizon-client-core, where it moved. Parity: Cargo.lock changes, so CI runs all harnesses. 🤖 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:14:44 +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#4109
No description provided.