[PR #450] [MERGED] World Options: vanilla layout, headings, port box, lock and footer #2574

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

📋 Pull Request Information

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

Base: main ← Head: fix/world-options-layout


📝 Commits (2)

  • 9f7c1c3 World Options: vanilla layout, headings, port box, lock, game rules and restrictions
  • 98321f5 World Options: tests of the layout and active states

📊 Changes

3 files changed (+268 additions, -81 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+3 -0)
📝 crates/horizon-client/src/game/lan_screen.rs (+264 -80)
📝 crates/horizon-client/src/game/options.rs (+1 -1)

📄 Description

Part of #373: the layout and states. The widgets Horizon can't back yet are listed under "Left for later".

What vanilla does (WorldOptionsScreen)

  • Frame. A HeaderAndFooterLayout (33 px each): the title centred in the header and the in-world header/footer separators. The INWORLD_MENU_LIST_BACKGROUND sits under the content.
  • Content. A ScrollableLayout (10 px a wheel step, scrollbar on the right) holding a vertical LinearLayout with spacing 8 and cell padding 8. Each section is a 2-column grid: columns 8 apart, rows 4 apart.
    • General: bold underlined FocusableTextWidget heading (padding 4), default and personal game mode (308 wide), Allow Commands, DifficultyButtons, then Edit Game Rules... and Restrictions...
    • DifficultyButtons is the difficulty cycle button narrowed to 130 so the 20 px LockIconButton fits beside it.
    • Multiplayer: its heading, LAN, the port EditBox (always a text box: uneditable 0x707070 text and a Port Number hint while LAN is off, the free port as hint while on, red 0xDF5050 text for an invalid port), Command Access, Force Game Mode.
  • Footer. Apply Changes and Cancel at h - 33 + (int)6.5 = h − 27. Horizon had h − 28.
  • Active states (updateButton, updateGuestCommandAccessButton, updateForceGameModeButton, DifficultyButtons.updateDifficultyButtonsState):
    • the game modes need Allow Commands and no hardcore;
    • turning commands off puts both game modes back to the world's default (updatePermissionDependentButtons);
    • hardcore disables difficulty and Force Game Mode and forces the latter on.

Changes (game/lan_screen.rs)

  • One layout function for drawing and clicking, the content scrolled and clipped between the separators, the scrollbar, the wheel (game.rs), and the states above.
  • Horizon's red "invalid port" line under the box is gone. Vanilla only colours the text and sets a tooltip.
  • options.rs: gui_size is shared with the screen.

Left for later (drawn inactive, as vanilla draws them when unavailable):

  • The difficulty lock. ServerboundLockDifficultyPacket with its PopupScreen confirmation; Horizon doesn't keep difficulty_settings.locked yet.
  • Edit Game Rules... (InWorldGameRulesScreen).
  • Restrictions... (RestrictionsScreen).
  • The buttons' tooltips.

How it was verified

  • Unit tests layout_follows_the_header_footer_and_grids (every widget's position at 427×240, the scroll range) and buttons_follow_commands_hardcore_and_lan.
  • In game (Mac mini, offscreen, GUI scale 3):
    • the screen at the top, scrolled down, and after turning LAN on (Apply becomes active, the port hint shows the free port);
    • headings, lock, the 130/20 split, the footer at h − 27, clipping at the separators and the scrollbar all match rdbtCVS's vanilla capture.

Self-check (fmt, clippy, client tests, parity) for the whole batch: see the last comment.

🤖 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/450 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/16/2026 **Status:** ✅ Merged **Merged:** 10/16/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/world-options-layout` --- ### 📝 Commits (2) - [`9f7c1c3`](https://github.com/horizon-rust/horizon/commit/9f7c1c3ce545903a063c1b9d33e141ee464d5388) World Options: vanilla layout, headings, port box, lock, game rules and restrictions - [`98321f5`](https://github.com/horizon-rust/horizon/commit/98321f5d8d149eb34f2c8e1f0b040cd21cef224e) World Options: tests of the layout and active states ### 📊 Changes **3 files changed** (+268 additions, -81 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+3 -0) 📝 `crates/horizon-client/src/game/lan_screen.rs` (+264 -80) 📝 `crates/horizon-client/src/game/options.rs` (+1 -1) </details> ### 📄 Description Part of #373: the layout and states. The widgets Horizon can't back yet are listed under "Left for later". **What vanilla does** (`WorldOptionsScreen`) - **Frame.** A `HeaderAndFooterLayout` (33 px each): the title centred in the header and the in-world header/footer separators. The `INWORLD_MENU_LIST_BACKGROUND` sits under the content. - **Content.** A `ScrollableLayout` (10 px a wheel step, scrollbar on the right) holding a vertical `LinearLayout` with spacing 8 and cell padding 8. Each section is a 2-column grid: columns 8 apart, rows 4 apart. - **General:** bold underlined `FocusableTextWidget` heading (padding 4), default and personal game mode (308 wide), Allow Commands, `DifficultyButtons`, then Edit Game Rules... and Restrictions... - `DifficultyButtons` is the difficulty cycle button narrowed to 130 so the 20 px `LockIconButton` fits beside it. - **Multiplayer:** its heading, LAN, the port `EditBox` (always a text box: uneditable `0x707070` text and a `Port Number` hint while LAN is off, the free port as hint while on, red `0xDF5050` text for an invalid port), Command Access, Force Game Mode. - **Footer.** Apply Changes and Cancel at `h - 33 + (int)6.5` = **h − 27**. Horizon had h − 28. - **Active states** (`updateButton`, `updateGuestCommandAccessButton`, `updateForceGameModeButton`, `DifficultyButtons.updateDifficultyButtonsState`): - the game modes need Allow Commands and no hardcore; - turning commands off puts both game modes back to the world's default (`updatePermissionDependentButtons`); - hardcore disables difficulty and Force Game Mode and forces the latter on. **Changes** (`game/lan_screen.rs`) - One layout function for drawing and clicking, the content scrolled and clipped between the separators, the scrollbar, the wheel (`game.rs`), and the states above. - Horizon's red "invalid port" line under the box is gone. Vanilla only colours the text and sets a tooltip. - `options.rs`: `gui_size` is shared with the screen. **Left for later** (drawn inactive, as vanilla draws them when unavailable): - **The difficulty lock.** `ServerboundLockDifficultyPacket` with its `PopupScreen` confirmation; Horizon doesn't keep `difficulty_settings.locked` yet. - **Edit Game Rules...** (`InWorldGameRulesScreen`). - **Restrictions...** (`RestrictionsScreen`). - The buttons' tooltips. **How it was verified** - Unit tests `layout_follows_the_header_footer_and_grids` (every widget's position at 427×240, the scroll range) and `buttons_follow_commands_hardcore_and_lan`. - In game (Mac mini, offscreen, GUI scale 3): - the screen at the top, scrolled down, and after turning LAN on (Apply becomes active, the port hint shows the free port); - headings, lock, the 130/20 split, the footer at h − 27, clipping at the separators and the scrollbar all match rdbtCVS's vanilla capture. Self-check (fmt, clippy, client tests, parity) for the whole batch: see the last comment. 🤖 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:57:18 +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#2574
No description provided.