[PR #2214] [MERGED] Superflat: the Customize screen edits layers and presets #4108

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2214
Author: @masa-masa-0314
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/27/2026
Merged by: @ludovic111

Base: main ← Head: fix/superflat-customize


📝 Commits (3)

  • 91f1f83 Superflat: the Customize screen edits layers and presets
  • 317f304 Superflat: keep an empty layer list on Re-Create
  • f1d14c9 Merge main into fix/superflat-customize (world_loading: keep the flat settings and main's game rules)

📊 Changes

5 files changed (+1053 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 (+884 -0)

📄 Description

🤖 Opened by masa-masa-0314's AI agent (ZCode), not by masa-masa-0314 personally.

Note

The original PR for this change disappeared, so I re-opened it here. The code is unchanged; the branch was rebased onto the current upstream/main (8027cb41) and rechecked.

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

After rebasing onto upstream/main at 8027cb41:

Check Result
Scope ⚠️ 5 files, +1051 −4; 1055 lines of code: over 500, the two vanilla screens ship together
Cargo.lock ✅ unchanged
Public tree ✅
rustfmt ✅
cargo check --all-targets ✅
clippy --all-targets -D warnings ✅
tests: horizon-client ➖ not repeated after the rebase; CI runs the suite
Parity ➖ not run (no vanilla data here): CI's parity job picks the affected harnesses
Label player-facing feature: feature

On the pre-rebase base the same code ran the full suite: 1143 passed, with only the two Windows-only failures that also fail on clean upstream/main (save::tests::session_lock_is_exclusive and crash::tests::stacks_start_at_the_panicking_frame).

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/2214 **Author:** [@masa-masa-0314](https://github.com/masa-masa-0314) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/superflat-customize` --- ### 📝 Commits (3) - [`91f1f83`](https://github.com/horizon-rust/horizon/commit/91f1f839ab9e5d637a15204bfc629a47d266bdeb) Superflat: the Customize screen edits layers and presets - [`317f304`](https://github.com/horizon-rust/horizon/commit/317f30427efaf0faa44fb0a4554d4652187dbf82) Superflat: keep an empty layer list on Re-Create - [`f1d14c9`](https://github.com/horizon-rust/horizon/commit/f1d14c918ffcaa86789bada4f4645cfa0c70a2c0) Merge main into fix/superflat-customize (world_loading: keep the flat settings and main's game rules) ### 📊 Changes **5 files changed** (+1053 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` (+884 -0) </details> ### 📄 Description > 🤖 Opened by masa-masa-0314's AI agent (ZCode), not by masa-masa-0314 personally. ## Note The original PR for this change disappeared, so I re-opened it here. The code is unchanged; the branch was rebased onto the current `upstream/main` (`8027cb41`) and rechecked. ## 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 After rebasing onto `upstream/main` at `8027cb41`: | Check | Result | | --- | --- | | Scope | ⚠️ 5 files, +1051 −4; 1055 lines of code: over 500, the two vanilla screens ship together | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | rustfmt | ✅ | | `cargo check --all-targets` | ✅ | | clippy `--all-targets -D warnings` | ✅ | | tests: horizon-client | ➖ not repeated after the rebase; CI runs the suite | | Parity | ➖ not run (no vanilla data here): CI's parity job picks the affected harnesses | | Label | player-facing feature: `feature` | On the pre-rebase base the same code ran the full suite: 1143 passed, with only the two Windows-only failures that also fail on clean `upstream/main` (`save::tests::session_lock_is_exclusive` and `crash::tests::stacks_start_at_the_panicking_frame`). ## 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:14:44 +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#4108
No description provided.