[PR #2860] [MERGED] refactor: block entity data moves down beside the chunk (crate split, step A) #4658

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

📋 Pull Request Information

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

Base: main ← Head: refactor/block-entity-data


📝 Commits (2)

  • 21ac444 refactor: block entity data moves down beside the chunk
  • ff8a13c Merge remote-tracking branch 'origin/main' into refactor/block-entity-data

📊 Changes

19 files changed (+442 additions, -409 deletions)

View changed files

📝 crates/horizon-client-core/src/lib.rs (+1 -0)
➕ crates/horizon-client-core/src/who.rs (+8 -0)
📝 crates/horizon-client/src/beehive.rs (+1 -14)
📝 crates/horizon-client/src/block_entities.rs (+1 -1)
📝 crates/horizon-client/src/brewing.rs (+2 -13)
📝 crates/horizon-client/src/chunk.rs (+3 -1)
➕ crates/horizon-client/src/chunk/block_entity.rs (+409 -0)
📝 crates/horizon-client/src/command_block.rs (+1 -16)
📝 crates/horizon-client/src/containers.rs (+4 -170)
📝 crates/horizon-client/src/mobs.rs (+1 -6)
📝 crates/horizon-client/src/mobs/spawner.rs (+2 -42)
📝 crates/horizon-client/src/mobs/trial_spawner.rs (+1 -47)
📝 crates/horizon-client/src/sculk.rs (+1 -42)
📝 crates/horizon-client/src/signs.rs (+1 -16)
📝 crates/horizon-client/src/skins.rs (+1 -7)
📝 crates/horizon-client/src/vault.rs (+1 -33)
📝 tools/test_spawner_parity.py (+1 -0)
📝 tools/test_trial_spawner_parity.py (+1 -0)
📝 tools/test_vault_parity.py (+2 -1)

📄 Description

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

Step A of the plan to break the cycle in horizon-client's lib (crate split, ci-speed). This is the one cut that needed a design choice, and the orchestrator chose it: block entities are world data, as in vanilla, so their data moves down beside the chunk and their behaviour stays where it is.

What

Chunk.block_entities held containers::BlockEntity, whose payloads were defined across containers, brewing, signs, sculk, mobs::spawner, mobs::trial_spawner, vault, beehive and command_block. Through that, chunk depended on most of the gameplay code.

  • The enum and every payload type move to a new chunk/block_entity.rs, as plain data (definitions and derives only):
    • containers' own types: Furnace, FurnaceKind, Campfire, Skull, SkullSkin, Crafter, Banner, CreakingHeart, Lectern, Beacon, Jukebox
    • BrewingStand; SignData, SignText
    • SculkEntity, SculkKind, and the vibration Data, Info and Selector
    • Spawner, SpawnData, CustomSpawnRules; TrialSpawner, ConfigSlot, TrialConfig
    • Vault, VaultConfig; Beehive, Occupant; CommandBlock
  • Every impl block stays in its feature module, and each of those modules re-exports its types under the old path. No caller changes.
  • Visibility only: Spawner.next, the Next enum and Selector.current become pub(crate), because their struct now lives in another module.
  • mobs::Who (Player or Mob(id), 5 lines) moves to horizon-client-core::who, because the vibration Info names it. mobs re-exports it.
  • The vault, spawner and trial_spawner harnesses add chunk/block_entity.rs to the sources they record.
  • Payloads main added since (EndGateway, ChiseledBookshelf with its Default, SkullSkin.dynamic) are defined in chunk/block_entity.rs too, and skins::NameOrId (the 5-line key SkullSkin.dynamic holds) moves beside it, with skins re-exporting it.

After this PR (with #2744), chunk reaches no gameplay module of the client lib.

Checks

Based on main since #2215 merged; this head is a merge of main 0e1fcaa3c into the branch (no rebase). Run on the Mac mini on that merge:

  • tools/pr_ready.py (full, harnesses included): green, block below.
  • tools/lan_e2e.py --check chest: PASS in-frame and PASS --server-thread (the chest opens and closes for host and guest).
  • Before the merge, on the branch stacked on #2215: tools/parity.py save_roundtrip world_reopen chunk_generation block_entity_anim block_entity_render block_entity_storage block_entity_tickers vault spawner trial_spawner: 10 passed, 0 failed.

pr_ready (tools/pr_ready.py on ludovics-mac-mini, against origin/main at 0e1fcaa3c, 34 min 54 s)

Check Result
Scope ⚠️ 19 files, +442 −409; 846 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 369 passed (30 s)
rustfmt ✅ (6 s)
clippy ✅ (1 min 42 s)
tests: horizon-client, horizon-client-core ✅ 1340 passed (4 min 0 s)
doc tests ✅ 0 passed (1 min 35 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ✅ 78 affected, 77 passed (26 min 58 s)
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The 846 lines are the moved definitions (442 in, 409 out); nothing else changes size.

🤖 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/2860 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `refactor/block-entity-data` --- ### 📝 Commits (2) - [`21ac444`](https://github.com/horizon-rust/horizon/commit/21ac444f28e2dbc08936d3d0f7bfc75a274feba5) refactor: block entity data moves down beside the chunk - [`ff8a13c`](https://github.com/horizon-rust/horizon/commit/ff8a13c99a56495c74cd626b8da24db7520c9659) Merge remote-tracking branch 'origin/main' into refactor/block-entity-data ### 📊 Changes **19 files changed** (+442 additions, -409 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-core/src/lib.rs` (+1 -0) ➕ `crates/horizon-client-core/src/who.rs` (+8 -0) 📝 `crates/horizon-client/src/beehive.rs` (+1 -14) 📝 `crates/horizon-client/src/block_entities.rs` (+1 -1) 📝 `crates/horizon-client/src/brewing.rs` (+2 -13) 📝 `crates/horizon-client/src/chunk.rs` (+3 -1) ➕ `crates/horizon-client/src/chunk/block_entity.rs` (+409 -0) 📝 `crates/horizon-client/src/command_block.rs` (+1 -16) 📝 `crates/horizon-client/src/containers.rs` (+4 -170) 📝 `crates/horizon-client/src/mobs.rs` (+1 -6) 📝 `crates/horizon-client/src/mobs/spawner.rs` (+2 -42) 📝 `crates/horizon-client/src/mobs/trial_spawner.rs` (+1 -47) 📝 `crates/horizon-client/src/sculk.rs` (+1 -42) 📝 `crates/horizon-client/src/signs.rs` (+1 -16) 📝 `crates/horizon-client/src/skins.rs` (+1 -7) 📝 `crates/horizon-client/src/vault.rs` (+1 -33) 📝 `tools/test_spawner_parity.py` (+1 -0) 📝 `tools/test_trial_spawner_parity.py` (+1 -0) 📝 `tools/test_vault_parity.py` (+2 -1) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Step A of the plan to break the cycle in horizon-client's lib (crate split, ci-speed). This is the one cut that needed a design choice, and the orchestrator chose it: block entities are world data, as in vanilla, so their data moves down beside the chunk and their behaviour stays where it is. ## What `Chunk.block_entities` held `containers::BlockEntity`, whose payloads were defined across containers, brewing, signs, sculk, mobs::spawner, mobs::trial_spawner, vault, beehive and command_block. Through that, `chunk` depended on most of the gameplay code. - The enum and every payload type move to a new `chunk/block_entity.rs`, as plain data (definitions and derives only): - containers' own types: Furnace, FurnaceKind, Campfire, Skull, SkullSkin, Crafter, Banner, CreakingHeart, Lectern, Beacon, Jukebox - BrewingStand; SignData, SignText - SculkEntity, SculkKind, and the vibration `Data`, `Info` and `Selector` - Spawner, SpawnData, CustomSpawnRules; TrialSpawner, ConfigSlot, TrialConfig - Vault, VaultConfig; Beehive, Occupant; CommandBlock - Every `impl` block stays in its feature module, and each of those modules re-exports its types under the old path. No caller changes. - Visibility only: `Spawner.next`, the `Next` enum and `Selector.current` become `pub(crate)`, because their struct now lives in another module. - `mobs::Who` (Player or Mob(id), 5 lines) moves to `horizon-client-core::who`, because the vibration `Info` names it. `mobs` re-exports it. - The vault, spawner and trial_spawner harnesses add `chunk/block_entity.rs` to the sources they record. - Payloads main added since (`EndGateway`, `ChiseledBookshelf` with its `Default`, `SkullSkin.dynamic`) are defined in `chunk/block_entity.rs` too, and `skins::NameOrId` (the 5-line key `SkullSkin.dynamic` holds) moves beside it, with `skins` re-exporting it. After this PR (with #2744), `chunk` reaches no gameplay module of the client lib. ## Checks Based on main since #2215 merged; this head is a merge of main 0e1fcaa3c into the branch (no rebase). Run on the Mac mini on that merge: - `tools/pr_ready.py` (full, harnesses included): green, block below. - `tools/lan_e2e.py --check chest`: **PASS** in-frame and **PASS** `--server-thread` (the chest opens and closes for host and guest). - Before the merge, on the branch stacked on #2215: `tools/parity.py save_roundtrip world_reopen chunk_generation block_entity_anim block_entity_render block_entity_storage block_entity_tickers vault spawner trial_spawner`: **10 passed, 0 failed**. **pr_ready** (`tools/pr_ready.py` on ludovics-mac-mini, against origin/main at 0e1fcaa3c, 34 min 54 s) | Check | Result | | --- | --- | | Scope | ⚠️ 19 files, +442 −409; 846 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 369 passed (30 s) | | rustfmt | ✅ (6 s) | | clippy | ✅ (1 min 42 s) | | tests: horizon-client, horizon-client-core | ✅ 1340 passed (4 min 0 s) | | doc tests | ✅ 0 passed (1 min 35 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ✅ 78 affected, 77 passed (26 min 58 s) | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The 846 lines are the moved definitions (442 in, 409 out); nothing else changes size. 🤖 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 05:07:00 +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#4658
No description provided.