[PR #304] [MERGED] Create New World: vanilla's Game, World and More tabs #2471

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

📋 Pull Request Information

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

Base: main ← Head: feat/create-world-tabs


📝 Commits (4)

  • 6953710 Blur the panorama behind the title menus' screens, as vanilla does (#282)
  • 587695e Multiplayer: vanilla's server list, with the LAN scanning header and its dots (#282)
  • a8bd497 World list and pack lists: vanilla scroller, dragged with the pointer
  • dc863a6 Create New World: vanilla's Game, World and More tabs

📊 Changes

17 files changed (+1864 additions, -404 deletions)

View changed files

📝 crates/horizon-client/src/front.rs (+3 -8)
📝 crates/horizon-client/src/game.rs (+46 -4)
📝 crates/horizon-client/src/game/agent.rs (+18 -3)
📝 crates/horizon-client/src/game/control.rs (+1 -1)
📝 crates/horizon-client/src/game/dedicated.rs (+7 -1)
📝 crates/horizon-client/src/gfx.rs (+23 -0)
📝 crates/horizon-client/src/lib.rs (+1 -0)
➕ crates/horizon-client/src/menu_blur.rs (+249 -0)
➕ crates/horizon-client/src/menu_blur.wgsl (+32 -0)
📝 crates/horizon-client/src/multiplayer.rs (+424 -151)
📝 crates/horizon-client/src/options_ui.rs (+8 -1)
📝 crates/horizon-client/src/pack_screen.rs (+38 -1)
📝 crates/horizon-client/src/save.rs (+146 -57)
📝 crates/horizon-client/src/title.rs (+162 -175)
➕ crates/horizon-client/src/title/create_world.rs (+498 -0)
📝 crates/horizon-client/src/title/tests.rs (+121 -2)
📝 crates/horizon-client/src/ui.rs (+87 -0)

📄 Description

Thanks to Cosmic (@Online5277) for #281: Horizon's Create New World screen was a single page (name, seed and a Survival/Creative button), nothing like 26.3's tabbed CreateWorldScreen.

Stacked on #303 → #301 → #299. Merge those first; it reuses #299's blurred panorama and menu background.

What (vanilla 26.3 CreateWorldScreen, MenuTabBar, GridLayoutTab, SwitchGrid, WorldCreationUiState)

  • Frame: the MenuTabBar with Game, World and More is 24 high, with tabsWidth = min(400, w) − 28, tabWidth = roundToward(tabsWidth / 3, 2) and x = roundToward((w − tabsWidth) / 2, 2). It draws the widget/tab* sprites, the menu background inside the selected tab, the focus underline, labels 3 pixels lower on unselected tabs, and header separators either side. Under it go tab_header_background and menu_background, and the footer separator over the screen. Create New World and Cancel (150 wide, 8 apart) are centred in a 33-pixel footer.
  • Layout: each tab's grid is aligned at (0.5, 1/6) in the area between the tab bar and the footer (GridLayoutTab.doLayout), with vanilla's widget sizes and 8-pixel row spacing.
  • Game tab: "World Name" over a 208-wide box (labeledElement, centred in the 210 column), whose tooltip is "Save folder: folder". Then three 210-wide cycle buttons:
    • Game Mode: Survival → Hardcore → Creative, with the mode's info tooltip.
    • Difficulty: Peaceful to Hard, with its info tooltip. Locked to Hard in Hardcore.
    • Allow Commands: follows the game mode until toggled, with the .info tooltip; off and locked in Hardcore. The label is "Allow Commands", not en_us's "Allow Cheats", because vanilla's deprecated.json renames selectWorld.allowCommands.new over it.
  • World tab:
    • Row 1: World Type (150) and Customize (150), 10 apart.
    • Seed: "Seed for the world generator" over a 308-wide box, which shows the dark-grey "Leave blank for a random seed" hint while it's empty and unfocused.
    • Switches: the SwitchGrid (310 wide, 4-pixel rows under its spacer row): Generate Structures (with its tooltip) and Bonus Chest (locked off in Hardcore). Labels are vertically centred on 44-wide ON/OFF buttons at the right.
  • More tab: Game Rules, Experiments and Data Packs, 210 wide.
  • Input: clicking a tab switches to it (with a click sound when it changes) and drops the text focus. Tab moves between the open tab's box and nothing. A click on a box focuses it.

What the choices do

  • Game mode, Hardcore, Difficulty and Allow Commands go to the new world's level.dat (GameType, hardcore, difficulty_settings, allowCommands).
  • World Type: Superflat writes world_gen_settings with world_preset/flat.json's overworld (bedrock, 2 dirt, grass, plains). Generate Structures and Bonus Chest go there too. The file is written before streaming starts, so the flat generator is used from the first chunk. Checked end to end: a Creative Superflat world created from the screen spawns at y −60 on grass, with allowCommands: 1.
  • Re-Create reads all of these back from the saved world.

Not wired yet (drawn as vanilla, inactive here)

  • World Type: offers only Default and Superflat, the presets Horizon generates. Large Biomes, Amplified and Single Biome aren't offered.
  • Customize: inactive, since there's no CreateFlatWorldScreen preset editor.
  • More tab: Game Rules, Experiments and Data Packs are inactive until their screens exist.
  • Generate Structures / Bonus Chest: saved, but Horizon's generator doesn't act on them yet (no bonus chest placement at spawn).

Screenshots (Horizon, offscreen on the Mac mini, GUI scale 3, synthetic panorama as in #299)

  • game-tab.png: the Game tab (name focused, Survival, Normal, OFF).
  • game-tab-hardcore-tooltip.png: Hardcore with Difficulty: Hard and Allow Commands: OFF locked, and the Hardcore info tooltip.
  • world-tab.png: World Type, inactive Customize, the seed hint, the switches.
  • more-tab.png: the More tab.
  • created-flat.png: the Superflat world it created.

Self-check

cargo fmt --all -- --check                                   ok
cargo clippy -p horizon-client --all-targets -- -D warnings  ok
cargo test -p horizon-client                                  ok (635 lib + integration)
  new: title::tests::create_world_tabs_follow_vanilla_and_their_choices_reach_the_action
       title::tests::new_world_generation_settings_round_trip
parity harnesses (tools/parity.py --changed origin/main, once on the stack tip dc863a66 = #299+#301+#303+#304)
                                             79 passed; light first hit a port already in use by another session's server, passed on rerun

Fixes #281

🤖 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/304 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/create-world-tabs` --- ### 📝 Commits (4) - [`6953710`](https://github.com/horizon-rust/horizon/commit/6953710c74fccbde4c7d928c3a577d11e3501610) Blur the panorama behind the title menus' screens, as vanilla does (#282) - [`587695e`](https://github.com/horizon-rust/horizon/commit/587695e108d4fc21f5922ef7518613552a6649ea) Multiplayer: vanilla's server list, with the LAN scanning header and its dots (#282) - [`a8bd497`](https://github.com/horizon-rust/horizon/commit/a8bd497132388f045874beb4486fbb8f07c83791) World list and pack lists: vanilla scroller, dragged with the pointer - [`dc863a6`](https://github.com/horizon-rust/horizon/commit/dc863a66a45643b2d6142ef6d462161e01b46b12) Create New World: vanilla's Game, World and More tabs ### 📊 Changes **17 files changed** (+1864 additions, -404 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/front.rs` (+3 -8) 📝 `crates/horizon-client/src/game.rs` (+46 -4) 📝 `crates/horizon-client/src/game/agent.rs` (+18 -3) 📝 `crates/horizon-client/src/game/control.rs` (+1 -1) 📝 `crates/horizon-client/src/game/dedicated.rs` (+7 -1) 📝 `crates/horizon-client/src/gfx.rs` (+23 -0) 📝 `crates/horizon-client/src/lib.rs` (+1 -0) ➕ `crates/horizon-client/src/menu_blur.rs` (+249 -0) ➕ `crates/horizon-client/src/menu_blur.wgsl` (+32 -0) 📝 `crates/horizon-client/src/multiplayer.rs` (+424 -151) 📝 `crates/horizon-client/src/options_ui.rs` (+8 -1) 📝 `crates/horizon-client/src/pack_screen.rs` (+38 -1) 📝 `crates/horizon-client/src/save.rs` (+146 -57) 📝 `crates/horizon-client/src/title.rs` (+162 -175) ➕ `crates/horizon-client/src/title/create_world.rs` (+498 -0) 📝 `crates/horizon-client/src/title/tests.rs` (+121 -2) 📝 `crates/horizon-client/src/ui.rs` (+87 -0) </details> ### 📄 Description Thanks to **Cosmic (@Online5277)** for #281: Horizon's Create New World screen was a single page (name, seed and a Survival/Creative button), nothing like 26.3's tabbed `CreateWorldScreen`. Stacked on #303 → #301 → #299. Merge those first; it reuses #299's blurred panorama and menu background. ## What (vanilla 26.3 `CreateWorldScreen`, `MenuTabBar`, `GridLayoutTab`, `SwitchGrid`, `WorldCreationUiState`) - **Frame:** the `MenuTabBar` with Game, World and More is 24 high, with `tabsWidth = min(400, w) − 28`, `tabWidth = roundToward(tabsWidth / 3, 2)` and x = `roundToward((w − tabsWidth) / 2, 2)`. It draws the `widget/tab*` sprites, the menu background inside the selected tab, the focus underline, labels 3 pixels lower on unselected tabs, and header separators either side. Under it go `tab_header_background` and `menu_background`, and the footer separator over the screen. Create New World and Cancel (150 wide, 8 apart) are centred in a 33-pixel footer. - **Layout:** each tab's grid is aligned at (0.5, 1/6) in the area between the tab bar and the footer (`GridLayoutTab.doLayout`), with vanilla's widget sizes and 8-pixel row spacing. - **Game tab:** "World Name" over a 208-wide box (`labeledElement`, centred in the 210 column), whose tooltip is "Save folder: *folder*". Then three 210-wide cycle buttons: - **Game Mode:** Survival → Hardcore → Creative, with the mode's info tooltip. - **Difficulty:** Peaceful to Hard, with its info tooltip. Locked to Hard in Hardcore. - **Allow Commands:** follows the game mode until toggled, with the `.info` tooltip; off and locked in Hardcore. The label is "Allow Commands", not en_us's "Allow Cheats", because vanilla's `deprecated.json` renames `selectWorld.allowCommands.new` over it. - **World tab:** - **Row 1:** World Type (150) and Customize (150), 10 apart. - **Seed:** "Seed for the world generator" over a 308-wide box, which shows the dark-grey "Leave blank for a random seed" hint while it's empty and unfocused. - **Switches:** the `SwitchGrid` (310 wide, 4-pixel rows under its spacer row): Generate Structures (with its tooltip) and Bonus Chest (locked off in Hardcore). Labels are vertically centred on 44-wide ON/OFF buttons at the right. - **More tab:** Game Rules, Experiments and Data Packs, 210 wide. - **Input:** clicking a tab switches to it (with a click sound when it changes) and drops the text focus. Tab moves between the open tab's box and nothing. A click on a box focuses it. ## What the choices do - Game mode, Hardcore, Difficulty and Allow Commands go to the new world's `level.dat` (`GameType`, `hardcore`, `difficulty_settings`, `allowCommands`). - **World Type: Superflat** writes `world_gen_settings` with `world_preset/flat.json`'s overworld (bedrock, 2 dirt, grass, plains). Generate Structures and Bonus Chest go there too. The file is written before streaming starts, so the flat generator is used from the first chunk. Checked end to end: a Creative Superflat world created from the screen spawns at y −60 on grass, with `allowCommands: 1`. - Re-Create reads all of these back from the saved world. ## Not wired yet (drawn as vanilla, inactive here) - **World Type:** offers only Default and Superflat, the presets Horizon generates. Large Biomes, Amplified and Single Biome aren't offered. - **Customize:** inactive, since there's no `CreateFlatWorldScreen` preset editor. - **More tab:** Game Rules, Experiments and Data Packs are inactive until their screens exist. - **Generate Structures / Bonus Chest:** saved, but Horizon's generator doesn't act on them yet (no bonus chest placement at spawn). ## Screenshots (Horizon, offscreen on the Mac mini, GUI scale 3, synthetic panorama as in #299) - `game-tab.png`: the Game tab (name focused, Survival, Normal, OFF). - `game-tab-hardcore-tooltip.png`: Hardcore with Difficulty: Hard and Allow Commands: OFF locked, and the Hardcore info tooltip. - `world-tab.png`: World Type, inactive Customize, the seed hint, the switches. - `more-tab.png`: the More tab. - `created-flat.png`: the Superflat world it created. ## Self-check ``` cargo fmt --all -- --check ok cargo clippy -p horizon-client --all-targets -- -D warnings ok cargo test -p horizon-client ok (635 lib + integration) new: title::tests::create_world_tabs_follow_vanilla_and_their_choices_reach_the_action title::tests::new_world_generation_settings_round_trip parity harnesses (tools/parity.py --changed origin/main, once on the stack tip dc863a66 = #299+#301+#303+#304) 79 passed; light first hit a port already in use by another session's server, passed on rerun ``` Fixes #281 🤖 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:56:28 +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#2471
No description provided.