[PR #2089] [CLOSED] Superflat: the Customize screen edits layers and presets #3995

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2089
Author: @kohad1ck
Created: 10/26/2026
Status: ❌ Closed

Base: main ← Head: fix/superflat-customize


📝 Commits (1)

  • 1008531 Superflat: the Customize screen edits layers and presets

📊 Changes

5 files changed (+1051 additions, -4 deletions)

View changed files

📝 crates/horizon-client/src/game/agent.rs (+16 -0)
📝 crates/horizon-client/src/game/world_loading.rs (+6 -1)
📝 crates/horizon-client/src/title.rs (+125 -0)
📝 crates/horizon-client/src/title/create_world.rs (+22 -3)
➕ crates/horizon-client/src/title/flat.rs (+882 -0)

📄 Description

🤖 Opened by kohad1ck's AI agent (ZCode), not by kohad1ck personally.

What and why

Fixes #1872. Create New World greyed out Customize for a Superflat world because Horizon had no preset editor at all. This brings vanilla's two screens:

  • CreateFlatWorldScreen: the layer list (top layer first) with each layer's item icon and height (Top - %s, %s, Bottom - %s), Remove Layer, and Done/Cancel. Rows scroll and show the selection; Remove Layer is enabled only with a layer selected.
  • PresetFlatWorldScreen: the nine flat_world_preset entries from the visible tag, their display items and translated names, the share box (layers;biome), and Select/Cancel. Block and biome ids in the share text are checked against the prepared registries.json and worldgen/biomes.json; a malformed list falls back to the default flat settings, as PresetFlatWorldScreen.fromString does.
  • Persistence: Done stores the layers in WorldOptions, and world creation writes them through write_world_gen_settings_with, so world_gen_settings keeps the custom generator instead of the preset's classic layers. Re-Create reads them back (WorldOptions::of_world) so the editor opens on the world's own layers.
  • The Customize button is enabled exactly when the World Type is Superflat.

The two screens ship together: CreateFlatWorldScreen alone can only remove layers, and the preset/share screen is what makes the button useful.

Vanilla reference

26.3 bytecode/source: CreateFlatWorldScreen (DetailsList, LayerEntry, createWorld.customize.flat.*), PresetFlatWorldScreen (fromString, save, PresetsList, createWorld.customize.presets.*), FlatLevelGeneratorSettings (layers bottom-up, biome, structure overrides), FlatLayerInfo, and WorldCreationUiState's flat preset. Preset data comes from data/minecraft/worldgen/flat_level_generator_preset and its visible tag. UI only; no parity harness.

Self-check

pr_ready (tools/pr_ready.py --base upstream/main on DESKTOP-3050AHP, against upstream/main at 2a0f4e39a, 2 min 28 s)

Check Result
Scope ⚠️ 5 files, +1051 −4; 1055 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (14 s)
clippy ✅ (30 s)
tests: horizon-client ❌ 1143 passed, 2 failed (1 min 37 s)
doc tests ✅ 0 passed (4 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (no vanilla data here): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The two failing tests reproduce on clean upstream/main on this Windows machine: save::tests::session_lock_is_exclusive (the OS reports the file locked by another process) and crash::tests::stacks_start_at_the_panicking_frame (backtrace paths use /src/crash.rs here instead of crates/horizon-client/src/crash.rs). They are unrelated to this change.

Screenshots

Not attached: offscreen rendering shows a blank window in this environment. The layout follows the vanilla screens above; the preset loading, the Done/Cancel flow, the world_gen_settings round trip and both pages' drawing were checked locally against the prepared 26.3 resources.

🤖 Generated with ZCode


🔄 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/2089 **Author:** [@kohad1ck](https://github.com/kohad1ck) **Created:** 10/26/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/superflat-customize` --- ### 📝 Commits (1) - [`1008531`](https://github.com/horizon-rust/horizon/commit/1008531be196849da4749c1bda195050c93b9d37) Superflat: the Customize screen edits layers and presets ### 📊 Changes **5 files changed** (+1051 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/agent.rs` (+16 -0) 📝 `crates/horizon-client/src/game/world_loading.rs` (+6 -1) 📝 `crates/horizon-client/src/title.rs` (+125 -0) 📝 `crates/horizon-client/src/title/create_world.rs` (+22 -3) ➕ `crates/horizon-client/src/title/flat.rs` (+882 -0) </details> ### 📄 Description > 🤖 Opened by kohad1ck's AI agent (ZCode), not by kohad1ck personally. ## What and why Fixes #1872. Create New World greyed out **Customize** for a Superflat world because Horizon had no preset editor at all. This brings vanilla's two screens: - **CreateFlatWorldScreen**: the layer list (top layer first) with each layer's item icon and height (`Top - %s`, `%s`, `Bottom - %s`), Remove Layer, and Done/Cancel. Rows scroll and show the selection; Remove Layer is enabled only with a layer selected. - **PresetFlatWorldScreen**: the nine `flat_world_preset` entries from the `visible` tag, their display items and translated names, the share box (`layers;biome`), and Select/Cancel. Block and biome ids in the share text are checked against the prepared `registries.json` and `worldgen/biomes.json`; a malformed list falls back to the default flat settings, as `PresetFlatWorldScreen.fromString` does. - **Persistence**: Done stores the layers in `WorldOptions`, and world creation writes them through `write_world_gen_settings_with`, so `world_gen_settings` keeps the custom generator instead of the preset's classic layers. Re-Create reads them back (`WorldOptions::of_world`) so the editor opens on the world's own layers. - The Customize button is enabled exactly when the World Type is Superflat. The two screens ship together: CreateFlatWorldScreen alone can only remove layers, and the preset/share screen is what makes the button useful. ## Vanilla reference 26.3 bytecode/source: `CreateFlatWorldScreen` (DetailsList, LayerEntry, `createWorld.customize.flat.*`), `PresetFlatWorldScreen` (`fromString`, `save`, `PresetsList`, `createWorld.customize.presets.*`), `FlatLevelGeneratorSettings` (layers bottom-up, biome, structure overrides), `FlatLayerInfo`, and `WorldCreationUiState`'s flat preset. Preset data comes from `data/minecraft/worldgen/flat_level_generator_preset` and its `visible` tag. UI only; no parity harness. ## Self-check **pr_ready** (`tools/pr_ready.py --base upstream/main` on DESKTOP-3050AHP, against upstream/main at 2a0f4e39a, 2 min 28 s) | Check | Result | | --- | --- | | Scope | ⚠️ 5 files, +1051 −4; 1055 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (14 s) | | clippy | ✅ (30 s) | | tests: horizon-client | ❌ 1143 passed, 2 failed (1 min 37 s) | | doc tests | ✅ 0 passed (4 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (no vanilla data here): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The two failing tests reproduce on clean `upstream/main` on this Windows machine: `save::tests::session_lock_is_exclusive` (the OS reports the file locked by another process) and `crash::tests::stacks_start_at_the_panicking_frame` (backtrace paths use `/src/crash.rs` here instead of `crates/horizon-client/src/crash.rs`). They are unrelated to this change. ## Screenshots Not attached: offscreen rendering shows a blank window in this environment. The layout follows the vanilla screens above; the preset loading, the Done/Cancel flow, the `world_gen_settings` round trip and both pages' drawing were checked locally against the prepared 26.3 resources. 🤖 Generated with ZCode --- <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:53 +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#3995
No description provided.