[PR #6428] [MERGED] Customize the single-biome preset, as vanilla does #6866

Closed
opened 2026-11-03 06:28:20 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6428
Author: @MSedgeMC
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/ui-single-biome


📝 Commits (4)

  • 2a53f80 Customize the single-biome preset, as vanilla does
  • 90c7ae2 Port ledger: the buffet biome picker is ported
  • d00ded8 Single biome: sort the rows with cached keys
  • a41747a Merge upstream/main into fix/ui-single-biome

📊 Changes

10 files changed (+650 additions, -14 deletions)

View changed files

📝 crates/horizon-client/src/game/agent.rs (+5 -0)
📝 crates/horizon-client/src/game/dedicated.rs (+3 -1)
📝 crates/horizon-client/src/game/world_loading.rs (+1 -0)
📝 crates/horizon-client/src/save.rs (+6 -3)
📝 crates/horizon-client/src/title.rs (+106 -0)
➕ crates/horizon-client/src/title/buffet.rs (+325 -0)
📝 crates/horizon-client/src/title/create_world.rs (+34 -2)
📝 crates/horizon-client/src/title/tests.rs (+162 -0)
📝 tools/port_map/client2-014.tsv (+6 -6)
📝 tools/port_map/client2-019.tsv (+2 -2)

📄 Description

Fixes #6346.

Vanilla. CreateWorldScreen$WorldTab enables its Customize button exactly when WorldCreationUiState.getPresetEditor() is non-null, and PresetEditor.EDITORS holds two entries: WorldPresets.FLAT → CreateFlatWorldScreen, WorldPresets.SINGLE_BIOME_SURFACE → CreateBuffetWorldScreen. The buffet screen (CreateBuffetWorldScreen, HeaderAndFooterLayout(40, 33)) has a title, a 200×15 search EditBox whose responder filters BiomeList, the biome list itself (ObjectSelectionList, rows showing Component.translatable(id.toLanguageKey("biome")) or the id when the language has no name for it, sorted by that name, filtered by a case-folded contains) and Done/Cancel in the footer, Done disabled until an entry is selected. Done runs CreateWorldScreen.getUiState().updateDimensions(PresetEditor.fixedBiomeConfigurator(biome)), which builds NoiseBasedChunkGenerator(new FixedBiomeSource(biome), NOISE_SETTINGS.OVERWORLD) and WorldDimensions.replaceOverworldGenerator; Re-Create starts the list on the biome of the current dimensions.

Horizon. create_world::buttons enabled Customize for WorldPreset::Flat alone, and save::write_world_gen_settings_with always wrote "biome_source": {"type": "minecraft:fixed", "biome": "minecraft:plains"} for the single-biome preset, so the preset's fixer had no screen and its one choice was hard-wired.

  • The Customize button is enabled for the flat and the single-biome presets (PresetEditor.EDITORS has no other screen) and opens CreateBuffetWorldScreen's equivalent for the single-biome one, over the biomes of the prepared worldgen data (worldgen/biomes.json, the registry the generator itself reads), sorted by display name and filtered by the search box.
  • WorldOptions carries the chosen biome (single_biome, plains by default), which write_world_gen_settings_with writes as the fixed biome source; WorldOptions::of_world reads a saved world's fixed biome back, so Re-Create opens on it, and changing the world type resets it, as the preset's own dimensions replace the previous ones.
  • The control socket reports the screen (customize-single-biome, with the biome and the query) next to the existing customize-flat state.
  • The port ledger's six CreateBuffetWorldScreen rows are no longer missing: they name the screen's functions in title/buffet.rs, and the two CreateWorldScreen rows about the Customize button name both editors PresetEditor.EDITORS holds.

Proven:

  • cargo test -q -p horizon-client-lib --lib (build box): 1253 passed; 0 failed; 40 ignored, and cargo test -q -p horizon-client-lib --lib single_biome again on the final tree: 2 passed; 0 failed.
  • cargo clippy -q -p horizon-client-lib --lib and cargo clippy -q -p horizon-client --lib (build box): no warnings.
  • cargo test -q -p horizon-client --lib screen_ids (build box): 1 passed; 585 filtered out, so the control-socket state compiles.
  • Two new tests in title/tests.rs. the_single_biome_preset_is_customized_into_the_generator drives the screen end to end: Customize is disabled on Normal and enabled on Flat and Single Biome, the press opens the screen with three fixture biomes (rows Badlands, Jungle, Plains; the preset's plains selected), a press on the second row sets minecraft:jungle, Done returns to Create New World with single_biome == "minecraft:jungle", and write_world_gen_settings_with then writes biome_source.biome == "minecraft:jungle" with WorldGen::read still reporting single_biome_surface; WorldOptions::of_world reads that biome back. the_single_biome_screen_cancels_and_filters_without_choosing types into the search box: the query narrows the rows to one, the biome the query hides leaves Done disabled, and Cancel keeps plains.

The commits after the full run edit tools/port_map/*.tsv and the buffet screen's row sort and hit test; the screen's own tests and clippy were rerun on that final tree.

upstream/main moved while this was open and its button-label test landed at the end of title/tests.rs where these tests were added; the branch now merges upstream/main (no rebase, no force-push) with both tests kept. cargo test -q -p horizon-client-lib --lib title::tests on the merged tree: 57 passed; 0 failed; 1248 filtered out.

Not proven:

  • Pixel parity with CreateBuffetWorldScreen's layout. The header and footer heights, the search box size, the row width and the title/search/Done/Cancel strings come from the class, and the rows draw the name at the entry's contentX + 5, contentY + 2; the list's row height (20), the search box's top and the buttons' vertical placement follow the convention title/flat.rs already uses for the other customize screen rather than a measurement of this one.
  • The collator. Vanilla sorts the names with ICU's Collator for the default locale; Horizon sorts case-folded by name with the id breaking ties, which orders the shipped biome names the same way but is not the same collation for every language.
  • A run in a real window: the screen was exercised through the title screens' own press/draw paths in the tests, not by hand on a desktop.
  • The port-map rows: tools/port_ledger.py map-check needs a ledger built from the game jar and the decompiled sources, which was not built here, so the rows were checked by hand against the shape of the adjacent CreateFlatWorldScreen rows.

Known limits:

  • The biome list is whatever the prepared resources hold; a resource tree without worldgen/biomes.json shows an empty list and Done stays disabled (it cannot write a biome the generator does not know).
  • Keyboard focus follows the recorded widgets as on the other title screens, but Enter on the list does not confirm Done; neither does it on the existing flat screen.
  • A saved single-biome world whose biome id is not in the prepared data keeps that id in WorldOptions but shows no selected row, so Done stays disabled until a row is picked.

🔄 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/6428 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/ui-single-biome` --- ### 📝 Commits (4) - [`2a53f80`](https://github.com/horizon-rust/horizon/commit/2a53f80b1fc86d7985fa3c547ad408cddd46b75b) Customize the single-biome preset, as vanilla does - [`90c7ae2`](https://github.com/horizon-rust/horizon/commit/90c7ae207113d4efc0c7c0f723781bba34ea87ed) Port ledger: the buffet biome picker is ported - [`d00ded8`](https://github.com/horizon-rust/horizon/commit/d00ded86c3d84e8a6c04debfef8c73f571508377) Single biome: sort the rows with cached keys - [`a41747a`](https://github.com/horizon-rust/horizon/commit/a41747ac512e3c2f5055575671b8b193b9db4818) Merge upstream/main into fix/ui-single-biome ### 📊 Changes **10 files changed** (+650 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/agent.rs` (+5 -0) 📝 `crates/horizon-client/src/game/dedicated.rs` (+3 -1) 📝 `crates/horizon-client/src/game/world_loading.rs` (+1 -0) 📝 `crates/horizon-client/src/save.rs` (+6 -3) 📝 `crates/horizon-client/src/title.rs` (+106 -0) ➕ `crates/horizon-client/src/title/buffet.rs` (+325 -0) 📝 `crates/horizon-client/src/title/create_world.rs` (+34 -2) 📝 `crates/horizon-client/src/title/tests.rs` (+162 -0) 📝 `tools/port_map/client2-014.tsv` (+6 -6) 📝 `tools/port_map/client2-019.tsv` (+2 -2) </details> ### 📄 Description Fixes #6346. **Vanilla.** `CreateWorldScreen$WorldTab` enables its Customize button exactly when `WorldCreationUiState.getPresetEditor()` is non-null, and `PresetEditor.EDITORS` holds two entries: `WorldPresets.FLAT` → `CreateFlatWorldScreen`, `WorldPresets.SINGLE_BIOME_SURFACE` → `CreateBuffetWorldScreen`. The buffet screen (`CreateBuffetWorldScreen`, `HeaderAndFooterLayout(40, 33)`) has a title, a 200×15 search `EditBox` whose responder filters `BiomeList`, the biome list itself (`ObjectSelectionList`, rows showing `Component.translatable(id.toLanguageKey("biome"))` or the id when the language has no name for it, sorted by that name, filtered by a case-folded `contains`) and Done/Cancel in the footer, Done disabled until an entry is selected. Done runs `CreateWorldScreen.getUiState().updateDimensions(PresetEditor.fixedBiomeConfigurator(biome))`, which builds `NoiseBasedChunkGenerator(new FixedBiomeSource(biome), NOISE_SETTINGS.OVERWORLD)` and `WorldDimensions.replaceOverworldGenerator`; Re-Create starts the list on the biome of the current dimensions. **Horizon.** `create_world::buttons` enabled Customize for `WorldPreset::Flat` alone, and `save::write_world_gen_settings_with` always wrote `"biome_source": {"type": "minecraft:fixed", "biome": "minecraft:plains"}` for the single-biome preset, so the preset's fixer had no screen and its one choice was hard-wired. - The Customize button is enabled for the flat and the single-biome presets (`PresetEditor.EDITORS` has no other screen) and opens `CreateBuffetWorldScreen`'s equivalent for the single-biome one, over the biomes of the prepared worldgen data (`worldgen/biomes.json`, the registry the generator itself reads), sorted by display name and filtered by the search box. - `WorldOptions` carries the chosen biome (`single_biome`, plains by default), which `write_world_gen_settings_with` writes as the fixed biome source; `WorldOptions::of_world` reads a saved world's fixed biome back, so Re-Create opens on it, and changing the world type resets it, as the preset's own dimensions replace the previous ones. - The control socket reports the screen (`customize-single-biome`, with the biome and the query) next to the existing `customize-flat` state. - The port ledger's six `CreateBuffetWorldScreen` rows are no longer `missing`: they name the screen's functions in `title/buffet.rs`, and the two `CreateWorldScreen` rows about the Customize button name both editors `PresetEditor.EDITORS` holds. **Proven:** - `cargo test -q -p horizon-client-lib --lib` (build box): `1253 passed; 0 failed; 40 ignored`, and `cargo test -q -p horizon-client-lib --lib single_biome` again on the final tree: `2 passed; 0 failed`. - `cargo clippy -q -p horizon-client-lib --lib` and `cargo clippy -q -p horizon-client --lib` (build box): no warnings. - `cargo test -q -p horizon-client --lib screen_ids` (build box): `1 passed; 585 filtered out`, so the control-socket state compiles. - Two new tests in `title/tests.rs`. `the_single_biome_preset_is_customized_into_the_generator` drives the screen end to end: Customize is disabled on Normal and enabled on Flat and Single Biome, the press opens the screen with three fixture biomes (rows Badlands, Jungle, Plains; the preset's plains selected), a press on the second row sets `minecraft:jungle`, Done returns to Create New World with `single_biome == "minecraft:jungle"`, and `write_world_gen_settings_with` then writes `biome_source.biome == "minecraft:jungle"` with `WorldGen::read` still reporting `single_biome_surface`; `WorldOptions::of_world` reads that biome back. `the_single_biome_screen_cancels_and_filters_without_choosing` types into the search box: the query narrows the rows to one, the biome the query hides leaves Done disabled, and Cancel keeps plains. The commits after the full run edit `tools/port_map/*.tsv` and the buffet screen's row sort and hit test; the screen's own tests and clippy were rerun on that final tree. `upstream/main` moved while this was open and its button-label test landed at the end of `title/tests.rs` where these tests were added; the branch now merges `upstream/main` (no rebase, no force-push) with both tests kept. `cargo test -q -p horizon-client-lib --lib title::tests` on the merged tree: `57 passed; 0 failed; 1248 filtered out`. **Not proven:** - Pixel parity with `CreateBuffetWorldScreen`'s layout. The header and footer heights, the search box size, the row width and the title/search/Done/Cancel strings come from the class, and the rows draw the name at the entry's `contentX + 5, contentY + 2`; the list's row height (20), the search box's top and the buttons' vertical placement follow the convention `title/flat.rs` already uses for the other customize screen rather than a measurement of this one. - The collator. Vanilla sorts the names with ICU's `Collator` for the default locale; Horizon sorts case-folded by name with the id breaking ties, which orders the shipped biome names the same way but is not the same collation for every language. - A run in a real window: the screen was exercised through the title screens' own press/draw paths in the tests, not by hand on a desktop. - The port-map rows: `tools/port_ledger.py map-check` needs a ledger built from the game jar and the decompiled sources, which was not built here, so the rows were checked by hand against the shape of the adjacent `CreateFlatWorldScreen` rows. **Known limits:** - The biome list is whatever the prepared resources hold; a resource tree without `worldgen/biomes.json` shows an empty list and Done stays disabled (it cannot write a biome the generator does not know). - Keyboard focus follows the recorded widgets as on the other title screens, but Enter on the list does not confirm Done; neither does it on the existing flat screen. - A saved single-biome world whose biome id is not in the prepared data keeps that id in `WorldOptions` but shows no selected row, so Done stays disabled until a row is picked. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:28:20 +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#6866
No description provided.