[PR #4342] [MERGED] Wire /place structure to the live level #5573

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4342
Author: @MSedgeMC
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @levzzz5154

Base: main ← Head: fix/4309-place-structure


📝 Commits (3)

  • dec8429 Wire /place structure to the live level
  • 934136e Merge hr/main into the /place structure branch
  • 9b611a2 Merge remote-tracking branch 'hr/main' into fix/pr-4342

📊 Changes

10 files changed (+229 additions, -19 deletions)

View changed files

📝 crates/horizon-client/src/game/commands/place.rs (+28 -3)
📝 crates/horizon-client/src/vanillagen.rs (+12 -0)
📝 crates/horizon-world/src/level/growth.rs (+64 -0)
📝 crates/horizon-world/src/worldgen/generator.rs (+46 -2)
📝 crates/horizon-world/src/worldgen/generator_structures.rs (+23 -1)
📝 crates/horizon-world/src/worldgen/live.rs (+10 -0)
📝 crates/horizon-world/src/worldgen/structure/start.rs (+22 -11)
📝 docs/rust-parity.md (+3 -1)
📝 tools/command_exec_corpus.py (+20 -0)
📝 tools/port_map/rest-015.tsv (+1 -1)

📄 Description

Fixes #4309.

PlaceCommand.placeStructure resolves the structure, generates a StructureStart for the position's chunk with a constant-true biome predicate (lambda$placeStructure$0: iconst_1 — the command ignores biomes, so a village placed in a swamp is built), checks that every chunk of the start's bounding box is loaded (argument.pos.unloaded), then calls StructureStart.placeInChunk for each chunk of that box in the live level, broadcasts commands.place.structure.success and returns 1. No level event.

Horizon's cmd_place implemented /place template, /place feature and /place jigsaw, but the structure arm validated the id and then always returned command.failed — which is exactly the "unexpected error" in the report. docs/rust-parity.md recorded live structure placement as pending.

The arm now generates the start through the existing generator machinery with any_biome (the command's predicate, not worldgen's biome set — create_starts still passes false, so generation is unchanged), reuses place_in_chunk over LevelFeatureWorld, iterates the bounding box in vanilla's x-then-z order drawing from the level random, and reports the success and failure messages. LevelFeatureWorld also stores a template's block-entity data now, so a placed chest keeps its loot table rather than losing it — that also reaches /place jigsaw.

What is proven: the branch compiles on a build box — cargo check -p horizon-world -p horizon-client exits 0 — and the vanilla behaviour above was audited independently from the jar, including the biome predicate, the bounding-box chunk range, the message keys and the absence of a level event.

What is not proven: nothing below the message layer has been run. Start generation with the biome predicate, the chunk loop, per-chunk clipping, piece placement into a live level and persistence are all exercised only by a new command_exec_corpus.py group (place structure, buried treasure: one piece, one chest, inside the loaded area), which compares the success message and a chest count against the real oracle when the parity job runs with data. The corpus case deliberately does not compare the chest's y, facing or loot table, the multi-chunk loop, or the failure paths.

Two known limits, neither introduced here as a silent behaviour:

  • Structure entities are dropped. PlacementContext::add_entity is still a no-op for a live level, so blocks land and entities do not: end-city shulkers, monument elder guardians, ocean-ruin drowned, mineshaft chest minecarts and template entities such as the pillager outpost's allay cage. Vanilla's placeInChunk spawns all of them; fixing it needs a spawn hook in LevelAccess, which is a separate change.
  • Unloaded chunks. Vanilla force-loads the chunks of the box; Horizon cannot synchronously, so a structure whose box reaches an unloaded chunk reports "That position is not loaded" where vanilla would build it. A village is wide enough to hit this at a normal render distance; buried treasure and other one-chunk structures do not.

🔄 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/4342 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix/4309-place-structure` --- ### 📝 Commits (3) - [`dec8429`](https://github.com/horizon-rust/horizon/commit/dec8429c3d50dd61dcfa6589c6a2ea93ad5c9d00) Wire /place structure to the live level - [`934136e`](https://github.com/horizon-rust/horizon/commit/934136e813a7a780005b1668ef9a76495a23bd28) Merge hr/main into the /place structure branch - [`9b611a2`](https://github.com/horizon-rust/horizon/commit/9b611a200b264b0e0fbb0cfa5f1b83dff3cba8d4) Merge remote-tracking branch 'hr/main' into fix/pr-4342 ### 📊 Changes **10 files changed** (+229 additions, -19 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/commands/place.rs` (+28 -3) 📝 `crates/horizon-client/src/vanillagen.rs` (+12 -0) 📝 `crates/horizon-world/src/level/growth.rs` (+64 -0) 📝 `crates/horizon-world/src/worldgen/generator.rs` (+46 -2) 📝 `crates/horizon-world/src/worldgen/generator_structures.rs` (+23 -1) 📝 `crates/horizon-world/src/worldgen/live.rs` (+10 -0) 📝 `crates/horizon-world/src/worldgen/structure/start.rs` (+22 -11) 📝 `docs/rust-parity.md` (+3 -1) 📝 `tools/command_exec_corpus.py` (+20 -0) 📝 `tools/port_map/rest-015.tsv` (+1 -1) </details> ### 📄 Description Fixes #4309. `PlaceCommand.placeStructure` resolves the structure, generates a `StructureStart` for the position's chunk with a **constant-true biome predicate** (`lambda$placeStructure$0: iconst_1` — the command ignores biomes, so a village placed in a swamp is built), checks that every chunk of the start's bounding box is loaded (`argument.pos.unloaded`), then calls `StructureStart.placeInChunk` for each chunk of that box in the live level, broadcasts `commands.place.structure.success` and returns 1. No level event. Horizon's `cmd_place` implemented `/place template`, `/place feature` and `/place jigsaw`, but the structure arm validated the id and then always returned `command.failed` — which is exactly the "unexpected error" in the report. `docs/rust-parity.md` recorded live structure placement as pending. The arm now generates the start through the existing generator machinery with `any_biome` (the command's predicate, not worldgen's biome set — `create_starts` still passes `false`, so generation is unchanged), reuses `place_in_chunk` over `LevelFeatureWorld`, iterates the bounding box in vanilla's x-then-z order drawing from the level random, and reports the success and failure messages. `LevelFeatureWorld` also stores a template's block-entity data now, so a placed chest keeps its loot table rather than losing it — that also reaches `/place jigsaw`. **What is proven:** the branch compiles on a build box — `cargo check -p horizon-world -p horizon-client` exits 0 — and the vanilla behaviour above was audited independently from the jar, including the biome predicate, the bounding-box chunk range, the message keys and the absence of a level event. **What is not proven:** nothing below the message layer has been run. Start generation with the biome predicate, the chunk loop, per-chunk clipping, piece placement into a live level and persistence are all exercised only by a new `command_exec_corpus.py` group (`place structure`, buried treasure: one piece, one chest, inside the loaded area), which compares the success message and a chest count against the real oracle when the parity job runs with data. The corpus case deliberately does not compare the chest's y, facing or loot table, the multi-chunk loop, or the failure paths. Two known limits, neither introduced here as a silent behaviour: - **Structure entities are dropped.** `PlacementContext::add_entity` is still a no-op for a live level, so blocks land and entities do not: end-city shulkers, monument elder guardians, ocean-ruin drowned, mineshaft chest minecarts and template entities such as the pillager outpost's allay cage. Vanilla's `placeInChunk` spawns all of them; fixing it needs a spawn hook in `LevelAccess`, which is a separate change. - **Unloaded chunks.** Vanilla force-loads the chunks of the box; Horizon cannot synchronously, so a structure whose box reaches an unloaded chunk reports "That position is not loaded" where vanilla would build it. A village is wide enough to hit this at a normal render distance; buried treasure and other one-chunk structures do not. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:13: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#5573
No description provided.