[PR #839] [MERGED] Structures: YUNG's API's jigsaw assembler for carried structures #2850

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

📋 Pull Request Information

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

Base: main ← Head: feat/yung-jigsaw-game


📝 Commits (1)

  • 3c08f74 Structures: YUNG's API's jigsaw assembler for carried structures

📊 Changes

4 files changed (+792 additions, -24 deletions)

View changed files

📝 crates/horizon-world/src/worldgen/structure.rs (+1 -0)
📝 crates/horizon-world/src/worldgen/structure/jigsaw.rs (+40 -15)
📝 crates/horizon-world/src/worldgen/structure/start.rs (+24 -9)
➕ crates/horizon-world/src/worldgen/structure/yung.rs (+727 -0)

📄 Description

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

The carry side, which writes these keys from YUNG's mods, is the next PR. This one is inert without it: vanilla data never holds horizon:yungsapi.

What

YUNG's mods (Better Dungeons, Better Ocean Monuments, Better Witch Huts, and the rest) build their structures with YUNG's API's own jigsaw assembler (JigsawManager / JigsawStructureAssembler), not vanilla's. A minecraft:jigsaw structure holding "horizon:yungsapi": {"min_y", "max_y"} now assembles that way:

  • Start piece: the pool's raw weighted entries, shuffled; a random rotation; the first entry with a priority wins, else one by weight (counted down from nextInt(total) + 1). The element's condition must hold. start_jigsaw_name anchors it as in vanilla.
  • Children: breadth-first. At each jigsaw the target pool is used unless the depth is the max depth, then the fallback, each with its own draw.
  • Per element, from the element's "horizon:yungsapi": a name capped by max_count over the whole structure, a min_depth/max_depth range, ignore_bounds, and a condition. The conditions are true, false, not, all_of, any_of, depth, altitude, random_chance, rotation and piece_in_horizontal_direction. Jigsaws are not sorted by selection priority, as YUNG's elements don't.
  • Bounds: the piece must fit in the free space left by its parent (the same box test as vanilla's), and stay within the structure's min_y/max_y and the build height, minus the padding.

Shared jigsaw code (Pool, Free, the element fields) is made pub(super) for the new structure/yung.rs; vanilla assembly doesn't change.

Measured (ATM10 8.3's carried mods, seed 1234, chunkgen_bench --starts, with #832 #833 and the carry PR)

  • Chunks -64..63: YUNG's Better Dungeons 0 → 72 starts (2,023 pieces: 66 small, 4 skeleton, 2 zombie dungeons). All starts 289 → 361, pieces 15,267 → 17,290.
  • Chunks -256..255: Better Dungeons 1,722 starts (1,581 small, 73 zombie, 68 skeleton), Better Witch Huts 11 (7 huts, 4 circles). Better Ocean Monuments 7 with #838 (its start template is past the old node cap).
  • Still not starting (later PRs): Better Desert Temples, Better Jungle Temples, Better Strongholds and Better Nether Fortresses use YUNG's own placements (ocean and river avoidance, stronghold ring sections, multi-set exclusion zones). Better Mineshafts and two Better Dungeons types are Java structure types. YUNG's mods also turn off their vanilla counterparts, which Horizon doesn't do yet, so vanilla monuments and witch huts still generate next to YUNG's.

Self-check

  • cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings: clean
  • cargo test -p horizon-world --lib -- structure: passed. New: picks_priority_pieces_then_by_weight, rules_cap_by_name_and_depth, conditions.
  • 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/839 **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/yung-jigsaw-game` --- ### 📝 Commits (1) - [`3c08f74`](https://github.com/horizon-rust/horizon/commit/3c08f74d79ba37259b6c0e50873c35e3be831cff) Structures: YUNG's API's jigsaw assembler for carried structures ### 📊 Changes **4 files changed** (+792 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-world/src/worldgen/structure.rs` (+1 -0) 📝 `crates/horizon-world/src/worldgen/structure/jigsaw.rs` (+40 -15) 📝 `crates/horizon-world/src/worldgen/structure/start.rs` (+24 -9) ➕ `crates/horizon-world/src/worldgen/structure/yung.rs` (+727 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. The carry side, which writes these keys from YUNG's mods, is the next PR. This one is inert without it: vanilla data never holds `horizon:yungsapi`. ## What YUNG's mods (Better Dungeons, Better Ocean Monuments, Better Witch Huts, and the rest) build their structures with YUNG's API's own jigsaw assembler (`JigsawManager` / `JigsawStructureAssembler`), not vanilla's. A `minecraft:jigsaw` structure holding `"horizon:yungsapi": {"min_y", "max_y"}` now assembles that way: - **Start piece**: the pool's raw weighted entries, shuffled; a random rotation; the first entry with a `priority` wins, else one by weight (counted down from `nextInt(total) + 1`). The element's condition must hold. `start_jigsaw_name` anchors it as in vanilla. - **Children**: breadth-first. At each jigsaw the target pool is used unless the depth is the max depth, then the fallback, each with its own draw. - **Per element**, from the element's `"horizon:yungsapi"`: a `name` capped by `max_count` over the whole structure, a `min_depth`/`max_depth` range, `ignore_bounds`, and a `condition`. The conditions are `true`, `false`, `not`, `all_of`, `any_of`, `depth`, `altitude`, `random_chance`, `rotation` and `piece_in_horizontal_direction`. Jigsaws are not sorted by selection priority, as YUNG's elements don't. - **Bounds**: the piece must fit in the free space left by its parent (the same box test as vanilla's), and stay within the structure's `min_y`/`max_y` and the build height, minus the padding. Shared jigsaw code (`Pool`, `Free`, the element fields) is made `pub(super)` for the new `structure/yung.rs`; vanilla assembly doesn't change. ## Measured (ATM10 8.3's carried mods, seed 1234, `chunkgen_bench --starts`, with #832 #833 and the carry PR) - Chunks -64..63: YUNG's Better Dungeons 0 → 72 starts (2,023 pieces: 66 small, 4 skeleton, 2 zombie dungeons). All starts 289 → 361, pieces 15,267 → 17,290. - Chunks -256..255: Better Dungeons 1,722 starts (1,581 small, 73 zombie, 68 skeleton), Better Witch Huts 11 (7 huts, 4 circles). Better Ocean Monuments 7 with #838 (its start template is past the old node cap). - Still not starting (later PRs): Better Desert Temples, Better Jungle Temples, Better Strongholds and Better Nether Fortresses use YUNG's own placements (ocean and river avoidance, stronghold ring sections, multi-set exclusion zones). Better Mineshafts and two Better Dungeons types are Java structure types. YUNG's mods also turn off their vanilla counterparts, which Horizon doesn't do yet, so vanilla monuments and witch huts still generate next to YUNG's. ## Self-check - `cargo fmt --all --check`, `cargo clippy --workspace --all-targets -- -D warnings`: clean - `cargo test -p horizon-world --lib -- structure`: passed. New: `picks_priority_pieces_then_by_weight`, `rules_cap_by_name_and_depth`, `conditions`. - 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:33 +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#2850
No description provided.