[PR #2077] [MERGED] Structures: save the remaining legacy pieces as vanilla does #3985

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

📋 Pull Request Information

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

Base: main ← Head: fix/structure-starts-3-legacy


📝 Commits (3)

  • c776d65 Structures: save jigsaw starts as StructureStart.createTag does
  • b7b3683 Structures: save template pieces as vanilla does
  • ad50996 Structures: save the remaining legacy pieces as vanilla does

📊 Changes

23 files changed (+779 additions, -17 deletions)

View changed files

📝 crates/horizon-world/examples/probe/main.rs (+2 -0)
📝 crates/horizon-world/examples/probe/structure_pieces.rs (+1 -1)
➕ crates/horizon-world/examples/probe/structure_start_nbt.rs (+74 -0)
📝 crates/horizon-world/src/level/mod.rs (+1 -0)
📝 crates/horizon-world/src/worldgen/structure.rs (+19 -0)
📝 crates/horizon-world/src/worldgen/structure/end_city.rs (+27 -14)
📝 crates/horizon-world/src/worldgen/structure/enhanced_terrain.rs (+3 -0)
📝 crates/horizon-world/src/worldgen/structure/fortress.rs (+23 -0)
📝 crates/horizon-world/src/worldgen/structure/jigsaw.rs (+128 -0)
📝 crates/horizon-world/src/worldgen/structure/legacy.rs (+30 -0)
📝 crates/horizon-world/src/worldgen/structure/mineshaft.rs (+51 -0)
📝 crates/horizon-world/src/worldgen/structure/monument.rs (+10 -0)
📝 crates/horizon-world/src/worldgen/structure/nether_fossil.rs (+3 -0)
📝 crates/horizon-world/src/worldgen/structure/ocean_ruin.rs (+2 -0)
📝 crates/horizon-world/src/worldgen/structure/piece_limited.rs (+11 -0)
📝 crates/horizon-world/src/worldgen/structure/processor.rs (+1 -1)
📝 crates/horizon-world/src/worldgen/structure/ruined_portal.rs (+42 -0)
📝 crates/horizon-world/src/worldgen/structure/simple.rs (+117 -0)
📝 crates/horizon-world/src/worldgen/structure/start.rs (+28 -0)
📝 crates/horizon-world/src/worldgen/structure/stronghold.rs (+42 -0)

...and 3 more files

📄 Description

🤖 Opened by FusselTV's AI agent (Claude Code, Opus 5.5), not by FusselTV personally.

What and why

Horizon kept no saveable form of its structure starts. Its saves carry an empty structures.starts, so every structure it generates is invisible to vanilla and Paper:

  • /locate structure and /locate maps do not find it,
  • structure mob spawns stop (witch huts, ocean monuments, fortresses, pillager outposts),
  • location_check predicates and advancements that key on a structure do not fire,
  • a structure crossing the edge of the generated area is not continued in the chunks vanilla generates next.

This is a stack of four PRs, each under 500 lines:

  1. jigsaw starts: #2075
  2. template pieces: #2076
  3. the remaining legacy pieces: #2077
  4. chunks write the starts they hold: #2078

GitHub does not let a fork stack PRs on each other's branches, so each PR targets main and contains the ones before it. Only the last commit is new in each.

This PR (3/4): the remaining legacy pieces. Builds on #2076; only the last commit is new. The following pieces save the tag their StructurePiece subclass writes: desert and jungle temples, swamp huts, buried treasure, ocean monuments, mineshafts, fortresses and strongholds. The tag carries the state that placement leaves behind:

  • the height a scattered feature settled on (HPos),
  • the buried treasure chest position,
  • placed chests, traps and spawners,
  • the swamp hut's witch and cat.

With this, every StructurePieceType is saved.

Vanilla reference

  • ScatteredFeaturePiece, DesertPyramidPiece, JunglePyramidPiece, SwampHutPiece, BuriedTreasurePieces, OceanMonumentPieces, MineshaftPieces, NetherFortressPieces, StrongholdPieces (their addAdditionalSaveData)

Tests

  • tools/test_structure_start_nbt_parity.py gets one site of each of these kinds and a badlands mineshaft. On this commit: 34 structure starts save as vanilla.
  • End to end: All fixes of this series (the five save PRs and the four structure-start PRs) merged onto main and run as a dedicated server, which pre-generated seed 12345, 4,096 chunks per dimension (radius 500 blocks), and the result was compared chunk by chunk with the same area from the pinned vanilla 26.3 server (compare.py, our own world-diff tool). Then the world was opened in Paper 26.3. Paper's log shows no exception and no skipped block entity. Overworld: 30 of 30 structure starts equal to vanilla's, 0 reference differences. Nether: 30 of 31 equal. For comparison, Paper's own world has 29 of 30 and 30 of 31. In Paper, locate structure minecraft:mineshaft finds the Horizon mineshaft, and location_check predicates pass inside the trial chambers and the bastion.

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on f42573060fff, against upstream/main at 57c5f8129, 2 min 11 s)

Check Result
Scope ⚠️ 23 files, +779 −17; 657 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 306 passed (22 s)
rustfmt ✅ (6 s)
clippy ✅ (13 s)
tests: horizon-world ✅ 236 passed (1 min 28 s)
doc tests ✅ 0 passed (2 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 337 affected, to run in CI (--quick): active_effect_tick, active_effects, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, auto_jump, bamboo, basic_feature, biome_chunk and 325 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 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/2077 **Author:** [@FusselTV](https://github.com/FusselTV) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/structure-starts-3-legacy` --- ### 📝 Commits (3) - [`c776d65`](https://github.com/horizon-rust/horizon/commit/c776d6586e24b7a09fdfe9ea2b3856575f241be7) Structures: save jigsaw starts as StructureStart.createTag does - [`b7b3683`](https://github.com/horizon-rust/horizon/commit/b7b36836af97cbc07c0e4747b242ac8ccb67b898) Structures: save template pieces as vanilla does - [`ad50996`](https://github.com/horizon-rust/horizon/commit/ad50996f7c087500de2d52dc366e268a9d400e99) Structures: save the remaining legacy pieces as vanilla does ### 📊 Changes **23 files changed** (+779 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-world/examples/probe/main.rs` (+2 -0) 📝 `crates/horizon-world/examples/probe/structure_pieces.rs` (+1 -1) ➕ `crates/horizon-world/examples/probe/structure_start_nbt.rs` (+74 -0) 📝 `crates/horizon-world/src/level/mod.rs` (+1 -0) 📝 `crates/horizon-world/src/worldgen/structure.rs` (+19 -0) 📝 `crates/horizon-world/src/worldgen/structure/end_city.rs` (+27 -14) 📝 `crates/horizon-world/src/worldgen/structure/enhanced_terrain.rs` (+3 -0) 📝 `crates/horizon-world/src/worldgen/structure/fortress.rs` (+23 -0) 📝 `crates/horizon-world/src/worldgen/structure/jigsaw.rs` (+128 -0) 📝 `crates/horizon-world/src/worldgen/structure/legacy.rs` (+30 -0) 📝 `crates/horizon-world/src/worldgen/structure/mineshaft.rs` (+51 -0) 📝 `crates/horizon-world/src/worldgen/structure/monument.rs` (+10 -0) 📝 `crates/horizon-world/src/worldgen/structure/nether_fossil.rs` (+3 -0) 📝 `crates/horizon-world/src/worldgen/structure/ocean_ruin.rs` (+2 -0) 📝 `crates/horizon-world/src/worldgen/structure/piece_limited.rs` (+11 -0) 📝 `crates/horizon-world/src/worldgen/structure/processor.rs` (+1 -1) 📝 `crates/horizon-world/src/worldgen/structure/ruined_portal.rs` (+42 -0) 📝 `crates/horizon-world/src/worldgen/structure/simple.rs` (+117 -0) 📝 `crates/horizon-world/src/worldgen/structure/start.rs` (+28 -0) 📝 `crates/horizon-world/src/worldgen/structure/stronghold.rs` (+42 -0) _...and 3 more files_ </details> ### 📄 Description > 🤖 Opened by FusselTV's AI agent (Claude Code, Opus 5.5), not by FusselTV personally. ## What and why Horizon kept no saveable form of its structure starts. Its saves carry an empty `structures.starts`, so every structure it generates is invisible to vanilla and Paper: - `/locate structure` and `/locate` maps do not find it, - structure mob spawns stop (witch huts, ocean monuments, fortresses, pillager outposts), - `location_check` predicates and advancements that key on a structure do not fire, - a structure crossing the edge of the generated area is not continued in the chunks vanilla generates next. This is a stack of four PRs, each under 500 lines: 1. jigsaw starts: #2075 2. template pieces: #2076 3. the remaining legacy pieces: #2077 4. chunks write the starts they hold: #2078 GitHub does not let a fork stack PRs on each other's branches, so each PR targets `main` and contains the ones before it. Only the last commit is new in each. **This PR (3/4): the remaining legacy pieces.** Builds on #2076; only the last commit is new. The following pieces save the tag their `StructurePiece` subclass writes: desert and jungle temples, swamp huts, buried treasure, ocean monuments, mineshafts, fortresses and strongholds. The tag carries the state that placement leaves behind: - the height a scattered feature settled on (`HPos`), - the buried treasure chest position, - placed chests, traps and spawners, - the swamp hut's witch and cat. With this, every `StructurePieceType` is saved. ## Vanilla reference - `ScatteredFeaturePiece`, `DesertPyramidPiece`, `JunglePyramidPiece`, `SwampHutPiece`, `BuriedTreasurePieces`, `OceanMonumentPieces`, `MineshaftPieces`, `NetherFortressPieces`, `StrongholdPieces` (their `addAdditionalSaveData`) ## Tests - `tools/test_structure_start_nbt_parity.py` gets one site of each of these kinds and a badlands mineshaft. On this commit: 34 structure starts save as vanilla. - End to end: All fixes of this series (the five save PRs and the four structure-start PRs) merged onto `main` and run as a dedicated server, which pre-generated seed 12345, 4,096 chunks per dimension (radius 500 blocks), and the result was compared chunk by chunk with the same area from the pinned vanilla 26.3 server (`compare.py`, our own world-diff tool). Then the world was opened in Paper 26.3. Paper's log shows no exception and no skipped block entity. Overworld: 30 of 30 structure starts equal to vanilla's, 0 reference differences. Nether: 30 of 31 equal. For comparison, Paper's own world has 29 of 30 and 30 of 31. In Paper, `locate structure minecraft:mineshaft` finds the Horizon mineshaft, and `location_check` predicates pass inside the trial chambers and the bastion. ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on f42573060fff, against upstream/main at 57c5f8129, 2 min 11 s) | Check | Result | | --- | --- | | Scope | ⚠️ 23 files, +779 −17; 657 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 306 passed (22 s) | | rustfmt | ✅ (6 s) | | clippy | ✅ (13 s) | | tests: horizon-world | ✅ 236 passed (1 min 28 s) | | doc tests | ✅ 0 passed (2 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 337 affected, to run in CI (--quick): active_effect_tick, active_effects, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, auto_jump, bamboo, basic_feature, biome_chunk and 325 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 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:13:48 +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#3985
No description provided.