[PR #850] [MERGED] Structures: Repurposed Structures' and Moog's piece-limited jigsaw assembler #2858

Closed
opened 2026-11-02 15:59:38 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: feat/piece-limited-jigsaw


📝 Commits (2)

  • 3c08f74 Structures: YUNG's API's jigsaw assembler for carried structures
  • f57c59a Structures: Repurposed Structures' and Moog's piece-limited jigsaw assembler

📊 Changes

5 files changed (+1793 additions, -26 deletions)

View changed files

📝 crates/horizon-world/src/worldgen/structure.rs (+2 -0)
📝 crates/horizon-world/src/worldgen/structure/jigsaw.rs (+41 -16)
➕ crates/horizon-world/src/worldgen/structure/piece_limited.rs (+980 -0)
📝 crates/horizon-world/src/worldgen/structure/start.rs (+43 -10)
➕ crates/horizon-world/src/worldgen/structure/yung.rs (+727 -0)

📄 Description

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

Stacked on #839: its first commit is #839's (shared jigsaw internals), so merge #839 first. The carry side is the next PR. Vanilla data never holds horizon:piece_limited, so vanilla worlds don't change.

What

Repurposed Structures and Moog's Structure Lib (behind MVS, MNS, MSS, MES) don't lay out their jigsaws with vanilla's JigsawPlacement. Both use PieceLimitedJigsawManager, the same code in each. Until now Horizon laid their structures out with vanilla's assembler, so pieces, caps and heights differed, and the Nether variants didn't start at all. A minecraft:jigsaw structure with "horizon:piece_limited" (new structure/piece_limited.rs) now assembles the way the mods do:

  • Start: a fresh random seeded by the chunk; the rotation, then a template drawn uniformly. It is moved to the surface at the piece's center (project_start_to_heightmap) and must stay within y_allowance.
  • Children: a bounding volume 120 blocks down and 180 up, breadth first. Each child is drawn by weight from the pool's entries in order (nextInt(total) + 1, counted down). The target pool is used unless the piece is at the last depth, then the fallback. Pools listed in pools_that_ignore_boundaries ignore the bounds when used as a fallback. Pieces must stay between y_allowance's bounds unless the structure is buried.
  • Piece counts (the mods' *_pieces_spawn_counts files): a cap per template, and required templates forced in once deep enough. The whole layout is retried up to 40 times until every required piece is in. The first short piece is taken in the order of Java's HashMap copy, as the mod iterates it.
  • After the layout (the structure's postLayoutAdjustments): the pieces are centred on the chunk corner, then buried: lowest_corner, average_land or lowest_side, with the mods' sea-level, liquid and y_allowance rules. The Nether variants instead move onto the highest or lowest land in the noise column at the layout's center (or a fixed height), plus ledge_offset_y, clipped to y_allowance. A layout past the build height is dropped.
  • The mods' differences ("library"): Repurposed's Nether variant has no fixed height or clip, and its movePieceProperly writes all three junction coordinates into the source X. Both are kept.

Not replicated: the mods' shared free-height cache. It is keyed by column only, not by heightmap type, and is cleared at 2,048 entries across all structures, so its result depends on generation order. Horizon reads the height each time.

Measured (ATM10 8.3's carried mods, seed 1234, chunks -64..63, chunkgen_bench --starts, with every PR of this agent and the carry PR)

  • Nether: Moog's Nether Structures 0 → 147 starts (607 pieces), Repurposed Structures' Nether structures 0 → 40 (275 pieces), MVS's Nether wells 0 → 3. All Nether starts 322 → 512.
  • Overworld: same starts (362), pieces 21,791 → 22,026. Repurposed's ocean villages give 352 pieces instead of 117 for the 2 in the square, its outposts 13 instead of 8. MVS's 91 starts are the same pieces, moved to the mod's heights and centres.
  • 321 carried structures use the key: Moog's 187 + 55 Nether, Repurposed 65 + 14 Nether. 21 are buried, 46 clipped by y_allowance, and 9 have piece counts.

Self-check

  • cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings: clean
  • cargo test -p horizon-world --lib -- structure: passed. New: required_pieces_follow_javas_hash_map, nether_land_is_found_in_the_column, repurposed_moves_junctions_as_its_code_does.
  • Vanilla structure-start oracle (seed 1234, chunks -24..23): 35 of 35 match.
  • Parity: all 304 harnesses that depend on the changed files pass on one integration of this agent's PRs (#832, #833, #838, #839, #840, #846, #847, #850, #851 merged onto origin/main at 845a122f): 298 run (298 passed, 0 failed in 82.4 min), 6 already passing for the same inputs. The vanilla structure-start oracle stays at 35/35.

Nothing needs Ludovic. The mod jars and their decompiled reference stayed in a local work folder.

🤖 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/850 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/18/2026 **Status:** ✅ Merged **Merged:** 10/18/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/piece-limited-jigsaw` --- ### 📝 Commits (2) - [`3c08f74`](https://github.com/horizon-rust/horizon/commit/3c08f74d79ba37259b6c0e50873c35e3be831cff) Structures: YUNG's API's jigsaw assembler for carried structures - [`f57c59a`](https://github.com/horizon-rust/horizon/commit/f57c59a971e2f04b77cc05123a0a7e016a4a3e84) Structures: Repurposed Structures' and Moog's piece-limited jigsaw assembler ### 📊 Changes **5 files changed** (+1793 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-world/src/worldgen/structure.rs` (+2 -0) 📝 `crates/horizon-world/src/worldgen/structure/jigsaw.rs` (+41 -16) ➕ `crates/horizon-world/src/worldgen/structure/piece_limited.rs` (+980 -0) 📝 `crates/horizon-world/src/worldgen/structure/start.rs` (+43 -10) ➕ `crates/horizon-world/src/worldgen/structure/yung.rs` (+727 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Stacked on #839: its first commit is #839's (shared jigsaw internals), so merge #839 first. The carry side is the next PR. Vanilla data never holds `horizon:piece_limited`, so vanilla worlds don't change. ## What Repurposed Structures and Moog's Structure Lib (behind MVS, MNS, MSS, MES) don't lay out their jigsaws with vanilla's `JigsawPlacement`. Both use `PieceLimitedJigsawManager`, the same code in each. Until now Horizon laid their structures out with vanilla's assembler, so pieces, caps and heights differed, and the Nether variants didn't start at all. A `minecraft:jigsaw` structure with `"horizon:piece_limited"` (new `structure/piece_limited.rs`) now assembles the way the mods do: - **Start**: a fresh random seeded by the chunk; the rotation, then a template drawn uniformly. It is moved to the surface at the piece's center (`project_start_to_heightmap`) and must stay within `y_allowance`. - **Children**: a bounding volume 120 blocks down and 180 up, breadth first. Each child is drawn by weight from the pool's entries in order (`nextInt(total) + 1`, counted down). The target pool is used unless the piece is at the last depth, then the fallback. Pools listed in `pools_that_ignore_boundaries` ignore the bounds when used as a fallback. Pieces must stay between `y_allowance`'s bounds unless the structure is buried. - **Piece counts** (the mods' `*_pieces_spawn_counts` files): a cap per template, and required templates forced in once deep enough. The whole layout is retried up to 40 times until every required piece is in. The first short piece is taken in the order of Java's `HashMap` copy, as the mod iterates it. - **After the layout** (the structure's `postLayoutAdjustments`): the pieces are centred on the chunk corner, then buried: `lowest_corner`, `average_land` or `lowest_side`, with the mods' sea-level, liquid and `y_allowance` rules. The Nether variants instead move onto the highest or lowest land in the noise column at the layout's center (or a fixed height), plus `ledge_offset_y`, clipped to `y_allowance`. A layout past the build height is dropped. - **The mods' differences** (`"library"`): Repurposed's Nether variant has no fixed height or clip, and its `movePieceProperly` writes all three junction coordinates into the source X. Both are kept. Not replicated: the mods' shared free-height cache. It is keyed by column only, not by heightmap type, and is cleared at 2,048 entries across all structures, so its result depends on generation order. Horizon reads the height each time. ## Measured (ATM10 8.3's carried mods, seed 1234, chunks -64..63, `chunkgen_bench --starts`, with every PR of this agent and the carry PR) - Nether: Moog's Nether Structures 0 → 147 starts (607 pieces), Repurposed Structures' Nether structures 0 → 40 (275 pieces), MVS's Nether wells 0 → 3. All Nether starts 322 → 512. - Overworld: same starts (362), pieces 21,791 → 22,026. Repurposed's ocean villages give 352 pieces instead of 117 for the 2 in the square, its outposts 13 instead of 8. MVS's 91 starts are the same pieces, moved to the mod's heights and centres. - 321 carried structures use the key: Moog's 187 + 55 Nether, Repurposed 65 + 14 Nether. 21 are buried, 46 clipped by `y_allowance`, and 9 have piece counts. ## Self-check - `cargo fmt --all --check`, `cargo clippy --workspace --all-targets -- -D warnings`: clean - `cargo test -p horizon-world --lib -- structure`: passed. New: `required_pieces_follow_javas_hash_map`, `nether_land_is_found_in_the_column`, `repurposed_moves_junctions_as_its_code_does`. - Vanilla structure-start oracle (seed 1234, chunks -24..23): 35 of 35 match. - Parity: all 304 harnesses that depend on the changed files pass on one integration of this agent's PRs (#832, #833, #838, #839, #840, #846, #847, #850, #851 merged onto origin/main at 845a122f): 298 run (298 passed, 0 failed in 82.4 min), 6 already passing for the same inputs. The vanilla structure-start oracle stays at 35/35. Nothing needs Ludovic. The mod jars and their decompiled reference stayed in a local work folder. 🤖 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-02 15:59:38 +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#2858
No description provided.