[PR #2078] [MERGED] Saves: write the structure starts a chunk holds #3987

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/2078
Author: @FusselTV
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @ludovic111

Base: main ← Head: fix/structure-starts


📝 Commits (4)

  • 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
  • c67a963 Saves: write the structure starts a chunk holds

📊 Changes

27 files changed (+817 additions, -22 deletions)

View changed files

📝 crates/horizon-client/src/chunk.rs (+4 -0)
📝 crates/horizon-client/src/save.rs (+19 -0)
📝 crates/horizon-client/src/vanillagen.rs (+6 -5)
📝 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/generator.rs (+9 -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)

...and 7 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 (4/4): chunks write the starts they hold. Builds on #2077; only the last commit is new.

  • A generated chunk keeps the starts it holds.
  • Its save writes them into structures.starts with their current state, as vanilla saves the StructureStart objects its chunks share.
  • Proto chunks get their references and starts too, so vanilla and Paper find the structures of the chunks they finish at the edge of a generated area.
  • A start with a piece that cannot be saved is left out, with a warning.

Vanilla reference

  • SerializableChunkData.packStructureData
  • ChunkAccess.getAllStarts / getAllReferences
  • StructureStart.createTag

Tests

  • tools/test_structure_start_nbt_parity.py: 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 a37fded4ff3d, against upstream/main at 57c5f8129, 5 min 39 s)

Check Result
Scope ⚠️ 27 files, +817 −22; 700 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 306 passed (21 s)
rustfmt ✅ (6 s)
clippy ✅ (16 s)
tests: horizon-client, horizon-world ✅ 1531 passed (4 min 52 s)
doc tests ✅ 0 passed (3 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/2078 **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` --- ### 📝 Commits (4) - [`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 - [`c67a963`](https://github.com/horizon-rust/horizon/commit/c67a963da7f60410fe7bf72abceb9293a5b484e3) Saves: write the structure starts a chunk holds ### 📊 Changes **27 files changed** (+817 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/chunk.rs` (+4 -0) 📝 `crates/horizon-client/src/save.rs` (+19 -0) 📝 `crates/horizon-client/src/vanillagen.rs` (+6 -5) 📝 `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/generator.rs` (+9 -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) _...and 7 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 (4/4): chunks write the starts they hold.** Builds on #2077; only the last commit is new. - A generated chunk keeps the starts it holds. - Its save writes them into `structures.starts` with their current state, as vanilla saves the `StructureStart` objects its chunks share. - Proto chunks get their references and starts too, so vanilla and Paper find the structures of the chunks they finish at the edge of a generated area. - A start with a piece that cannot be saved is left out, with a warning. ## Vanilla reference - `SerializableChunkData.packStructureData` - `ChunkAccess.getAllStarts` / `getAllReferences` - `StructureStart.createTag` ## Tests - `tools/test_structure_start_nbt_parity.py`: 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 a37fded4ff3d, against upstream/main at 57c5f8129, 5 min 39 s) | Check | Result | | --- | --- | | Scope | ⚠️ 27 files, +817 −22; 700 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 306 passed (21 s) | | rustfmt | ✅ (6 s) | | clippy | ✅ (16 s) | | tests: horizon-client, horizon-world | ✅ 1531 passed (4 min 52 s) | | doc tests | ✅ 0 passed (3 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#3987
No description provided.