[PR #958] [MERGED] YUNG's assembler: modifiers, piece_in_range and dead-end pools #2940

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

📋 Pull Request Information

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

Base: main ← Head: feat/yung-modifiers


📝 Commits (1)

  • be85b81 YUNG's assembler: modifiers, piece_in_range and dead-end pools

📊 Changes

2 files changed (+422 additions, -29 deletions)

View changed files

📝 crates/horizon-world/src/worldgen/structure/jigsaw.rs (+2 -2)
📝 crates/horizon-world/src/worldgen/structure/yung.rs (+420 -27)

📄 Description

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

Carry writes these rules in #959. This PR builds alone; vanilla data never has horizon:yungsapi.

What

Better Nether Fortresses relies on three parts of YUNG's API the game's YUNG assembler (#839) did not have. They are what make its bridges end and its pillars change:

  • piece_in_range: another piece (of some templates, or any with yungsapi:all) inside the piece's box grown sideways, below and above it. It must not overlap the piece and must not be the piece itself.
  • Modifiers, applied once the layout is done, in piece order, with the assembler's random. Each has a condition, then actions on the piece itself (self, the API's only target):
    • transform swaps the template for one picked by setFeatureSeed(x, y, x) of the piece's position, and moves the piece by an offset turned with it. Like the API's new piece, it loses its junctions and takes its own liquid setting.
    • delay_generation moves the piece to the end of the list.
    • A condition checked after a transform sees the new box, but its altitude is the one taken before, as the API's context has it.
  • Dead-end pools: a piece with a dead-end pool that gets no child, though it has other jigsaws, is taken out. Its parent's junction, its room and its count are given back, and a piece of the dead-end pool is chosen for the same parent jigsaw. The start piece stays.

How

  • Rules gain deadend_pool and modifiers, and Condition gains PieceInRange.
  • The assembler keeps, per piece, the slot it was placed in and the junction it left on its parent. A dead end marks the piece gone instead of shifting indices, and the conditions skip gone pieces. modified() applies the modifiers and returns the pieces kept, delayed ones last.
  • PoolElement derives Clone (for the transformed copy) and Junction derives PartialEq. Neither changes vanilla.

Proof (ATM10's carried mods with #959 and #957, seed 1234, Nether chunks -64..63, chunkgen_bench --starts)

  • Better Fortresses: same 7 starts, 3,765 → 4,106 pieces: the dead-end terminators and the moved beacon pillars. No other structure changes in the Nether or over overworld chunks -256..255 (Better Dungeons, Strongholds, Ocean Monuments, Jungle Temples and Witch Huts are piece for piece the same).
  • Tests:
    • piece_in_range_searches_a_grown_box: the range, templates, unknown templates and gone pieces.
    • transform_picks_by_position_and_turns_its_offset: the pick checked against Java's Random with seed x + y + 10000·x, the rotated offset, junctions cleared, liquid setting.
  • Vanilla is unchanged: the structure harnesses below pass.

Self-check

cargo fmt --all --check                                   ok
cargo clippy --workspace --all-targets -- -D warnings     ok
cargo test -p horizon-world                               ok
tools/parity.py --changed origin/main (integration commit) 311 passed, 0 failed (72 min, integration commit of #954-#964)

Nothing needs Ludovic.

🤖 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/958 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/19/2026 **Status:** ✅ Merged **Merged:** 10/19/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/yung-modifiers` --- ### 📝 Commits (1) - [`be85b81`](https://github.com/horizon-rust/horizon/commit/be85b81d136d81054da2b370a3f138752d671f63) YUNG's assembler: modifiers, piece_in_range and dead-end pools ### 📊 Changes **2 files changed** (+422 additions, -29 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-world/src/worldgen/structure/jigsaw.rs` (+2 -2) 📝 `crates/horizon-world/src/worldgen/structure/yung.rs` (+420 -27) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Carry writes these rules in #959. This PR builds alone; vanilla data never has `horizon:yungsapi`. ## What Better Nether Fortresses relies on three parts of YUNG's API the game's YUNG assembler (#839) did not have. They are what make its bridges end and its pillars change: - **`piece_in_range`**: another piece (of some templates, or any with `yungsapi:all`) inside the piece's box grown sideways, below and above it. It must not overlap the piece and must not be the piece itself. - **Modifiers**, applied once the layout is done, in piece order, with the assembler's random. Each has a condition, then actions on the piece itself (`self`, the API's only target): - `transform` swaps the template for one picked by `setFeatureSeed(x, y, x)` of the piece's position, and moves the piece by an offset turned with it. Like the API's new piece, it loses its junctions and takes its own liquid setting. - `delay_generation` moves the piece to the end of the list. - A condition checked after a transform sees the new box, but its altitude is the one taken before, as the API's context has it. - **Dead-end pools**: a piece with a dead-end pool that gets no child, though it has other jigsaws, is taken out. Its parent's junction, its room and its count are given back, and a piece of the dead-end pool is chosen for the same parent jigsaw. The start piece stays. ## How - `Rules` gain `deadend_pool` and `modifiers`, and `Condition` gains `PieceInRange`. - The assembler keeps, per piece, the slot it was placed in and the junction it left on its parent. A dead end marks the piece gone instead of shifting indices, and the conditions skip gone pieces. `modified()` applies the modifiers and returns the pieces kept, delayed ones last. - `PoolElement` derives `Clone` (for the transformed copy) and `Junction` derives `PartialEq`. Neither changes vanilla. ## Proof (ATM10's carried mods with #959 and #957, seed 1234, Nether chunks -64..63, `chunkgen_bench --starts`) - Better Fortresses: same 7 starts, 3,765 → 4,106 pieces: the dead-end terminators and the moved beacon pillars. No other structure changes in the Nether or over overworld chunks -256..255 (Better Dungeons, Strongholds, Ocean Monuments, Jungle Temples and Witch Huts are piece for piece the same). - Tests: - `piece_in_range_searches_a_grown_box`: the range, templates, unknown templates and gone pieces. - `transform_picks_by_position_and_turns_its_offset`: the pick checked against Java's `Random` with seed x + y + 10000·x, the rotated offset, junctions cleared, liquid setting. - Vanilla is unchanged: the structure harnesses below pass. ## Self-check ``` cargo fmt --all --check ok cargo clippy --workspace --all-targets -- -D warnings ok cargo test -p horizon-world ok tools/parity.py --changed origin/main (integration commit) 311 passed, 0 failed (72 min, integration commit of #954-#964) ``` Nothing needs Ludovic. 🤖 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 16:00:16 +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#2940
No description provided.