[PR #3187] [MERGED] Crate split B8: spawner, trial spawner and beehive logic as extension traits #4835

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

📋 Pull Request Information

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

Base: main ← Head: refactor/spawner-hive-traits


📝 Commits (3)

  • f6807fe refactor: spawner, trial spawner and beehive logic as extension traits
  • d0a29a0 Merge branch 'refactor/furnace-cooking' into refactor/spawner-hive-traits
  • ab0f591 Merge origin/main into refactor/spawner-hive-traits

📊 Changes

13 files changed (+354 additions, -186 deletions)

View changed files

📝 crates/horizon-client/examples/probe/mob_ai_probe.rs (+1 -1)
📝 crates/horizon-client/examples/probe/natural_spawn_fixture.rs (+5 -2)
📝 crates/horizon-client/src/beehive.rs (+58 -22)
📝 crates/horizon-client/src/chunk/block_entity.rs (+60 -0)
📝 crates/horizon-client/src/game/beehives.rs (+1 -1)
📝 crates/horizon-client/src/game/dispense_fixture.rs (+4 -1)
📝 crates/horizon-client/src/game/spawner.rs (+2 -2)
📝 crates/horizon-client/src/game/trial_spawner.rs (+1 -1)
📝 crates/horizon-client/src/lan/chunks.rs (+1 -0)
📝 crates/horizon-client/src/mobs/bee.rs (+1 -0)
📝 crates/horizon-client/src/mobs/spawner.rs (+84 -68)
📝 crates/horizon-client/src/mobs/trial_spawner.rs (+132 -88)
📝 crates/horizon-client/src/save.rs (+4 -0)

📄 Description

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

Step B8 of the horizon-client crate split (ci-speed, Ludovic's priority 1). B7 (#3180) has merged; this branch now has main (142388e1c) merged in, including #3064 and #2952, which this PR was held for.

What

Move only. The spawner, trial spawner and beehive data have lived in chunk::block_entity since the block-entity cut (#2860). Their behaviour needs mobs, so it stays above the data. Once the data moves into its own crate (B9, #3186, draft), Rust allows no inherent impl outside that crate. So in this PR each impl block becomes an extension trait in the same module, with the same method bodies:

  • beehive: OccupantExt, BeehiveExt;
  • mobs::spawner: SpawnDataExt, SpawnerExt;
  • mobs::trial_spawner: TrialConfigExt, TrialSpawnerExt.

The Default impls of Spawner, TrialConfig and TrialSpawner (plain field values) move next to their structs. Callers add one use for the trait.

No behaviour change.

Adapting to #3064 and #2952 (both merged)

The merge of main (ab0f59167) keeps their behaviour exactly:

  • #3064 added TrialConfig::encode and TrialSpawner::override_entity to the inherent impls this PR turns into traits. Both are now methods of TrialConfigExt / TrialSpawnerExt, with the same bodies, and game/spawner.rs imports TrialSpawnerExt.
  • #2952's lan/chunks.rs calls SpawnData::encode, so it imports SpawnDataExt.

These are the same fixes as in union/cs1-b9-3048. The head also merges cleanly with today's main (791d8b895).

Checks

Full tools/pr_ready.py on the Mac mini, harnesses included, on ab0f59167. cargo check --workspace --all-targets is clean with no warnings. The Label row is the tool's generic hint for game crates: this is a pure refactor, so skip-release.

pr_ready (tools/pr_ready.py on ludovics-mac-mini, against origin/main at 142388e1c, 50 min 49 s)

Check Result
Scope ⚠️ 13 files, +354 −186; 540 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 408 passed (2 min 15 s)
rustfmt ✅ (4 s)
clippy ✅ (1 min 13 s)
tests: horizon-client ✅ 1286 passed (3 min 16 s)
doc tests ✅ 0 passed (45 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 ✅ 82 affected, 81 passed (43 min 5 s)
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Parity: 0 failed.

🤖 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/3187 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `refactor/spawner-hive-traits` --- ### 📝 Commits (3) - [`f6807fe`](https://github.com/horizon-rust/horizon/commit/f6807fe7cdd6a3811cd38767f49cb2ac0199afed) refactor: spawner, trial spawner and beehive logic as extension traits - [`d0a29a0`](https://github.com/horizon-rust/horizon/commit/d0a29a0f66a88545cdda34cc46660eb3b7b187da) Merge branch 'refactor/furnace-cooking' into refactor/spawner-hive-traits - [`ab0f591`](https://github.com/horizon-rust/horizon/commit/ab0f59167390155e213e53f0655c4fa97be002c3) Merge origin/main into refactor/spawner-hive-traits ### 📊 Changes **13 files changed** (+354 additions, -186 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/probe/mob_ai_probe.rs` (+1 -1) 📝 `crates/horizon-client/examples/probe/natural_spawn_fixture.rs` (+5 -2) 📝 `crates/horizon-client/src/beehive.rs` (+58 -22) 📝 `crates/horizon-client/src/chunk/block_entity.rs` (+60 -0) 📝 `crates/horizon-client/src/game/beehives.rs` (+1 -1) 📝 `crates/horizon-client/src/game/dispense_fixture.rs` (+4 -1) 📝 `crates/horizon-client/src/game/spawner.rs` (+2 -2) 📝 `crates/horizon-client/src/game/trial_spawner.rs` (+1 -1) 📝 `crates/horizon-client/src/lan/chunks.rs` (+1 -0) 📝 `crates/horizon-client/src/mobs/bee.rs` (+1 -0) 📝 `crates/horizon-client/src/mobs/spawner.rs` (+84 -68) 📝 `crates/horizon-client/src/mobs/trial_spawner.rs` (+132 -88) 📝 `crates/horizon-client/src/save.rs` (+4 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Step B8 of the horizon-client crate split (ci-speed, Ludovic's priority 1). B7 (#3180) has merged; this branch now has main (142388e1c) merged in, including #3064 and #2952, which this PR was held for. ## What Move only. The spawner, trial spawner and beehive data have lived in `chunk::block_entity` since the block-entity cut (#2860). Their behaviour needs `mobs`, so it stays above the data. Once the data moves into its own crate (B9, #3186, draft), Rust allows no inherent impl outside that crate. So in this PR each impl block becomes an extension trait in the same module, with the same method bodies: - beehive: `OccupantExt`, `BeehiveExt`; - mobs::spawner: `SpawnDataExt`, `SpawnerExt`; - mobs::trial_spawner: `TrialConfigExt`, `TrialSpawnerExt`. The `Default` impls of `Spawner`, `TrialConfig` and `TrialSpawner` (plain field values) move next to their structs. Callers add one `use` for the trait. No behaviour change. ## Adapting to #3064 and #2952 (both merged) The merge of main (ab0f59167) keeps their behaviour exactly: - #3064 added `TrialConfig::encode` and `TrialSpawner::override_entity` to the inherent impls this PR turns into traits. Both are now methods of `TrialConfigExt` / `TrialSpawnerExt`, with the same bodies, and `game/spawner.rs` imports `TrialSpawnerExt`. - #2952's `lan/chunks.rs` calls `SpawnData::encode`, so it imports `SpawnDataExt`. These are the same fixes as in [`union/cs1-b9-3048`](https://github.com/horizon-rust/horizon/tree/union/cs1-b9-3048). The head also merges cleanly with today's main (791d8b895). ## Checks Full `tools/pr_ready.py` on the Mac mini, harnesses included, on ab0f59167. `cargo check --workspace --all-targets` is clean with no warnings. The Label row is the tool's generic hint for game crates: this is a pure refactor, so `skip-release`. **pr_ready** (`tools/pr_ready.py` on ludovics-mac-mini, against origin/main at 142388e1c, 50 min 49 s) | Check | Result | | --- | --- | | Scope | ⚠️ 13 files, +354 −186; 540 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 408 passed (2 min 15 s) | | rustfmt | ✅ (4 s) | | clippy | ✅ (1 min 13 s) | | tests: horizon-client | ✅ 1286 passed (3 min 16 s) | | doc tests | ✅ 0 passed (45 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 | ✅ 82 affected, 81 passed (43 min 5 s) | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Parity: 0 failed. 🤖 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:08:18 +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#4835
No description provided.