[PR #421] [MERGED] Server list rows: favicons, styled MOTDs, player count colours, icon arrows #2552

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

📋 Pull Request Information

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

Base: main ← Head: fix/server-list-entries


📝 Commits (1)

  • 37f6481 Server list rows: favicons, styled MOTDs, player count colours, icon arrows

📊 Changes

3 files changed (+333 additions, -62 deletions)

View changed files

📝 crates/horizon-client/src/front.rs (+8 -2)
📝 crates/horizon-client/src/multiplayer.rs (+324 -60)
📝 crates/horizon-client/src/title.rs (+1 -0)

📄 Description

Fixes #365
Fixes #378
Fixes #370

Server list rows now draw what vanilla's ServerSelectionList.OnlineServerEntry.extractContent draws.

What vanilla does

  • Icon (#365). ServerStatusPinger reads ServerStatus.Favicon (a data:image/png;base64, URL) into ServerData.setIconBytes. OnlineServerEntry.uploadServerIcon hands it to FaviconTexture.upload, which only takes 64×64 PNGs. The bytes are saved in servers.dat (updateServerList), so the icon shows before the next ping.
  • MOTD formatting (#365). data.motd = sanitizeDescription(status.description()) is a styled component. The font also applies legacy § codes inside it (StringDecomposer.iterateFormatted). It is split to contentWidth - 34 and at most two lines are drawn.
  • Player count (#378). ServerStatusPinger.formatPlayerCount draws multiplayer.status.player_count in DARK_GRAY with both numbers in GRAY, or multiplayer.status.unknown when the status has no players.
  • Hover icons (#370). A hovered row gets a 0xA0909090 fill over the icon plus the server_list/join arrow, move_up (when not first) and move_down (when not last). Each is _highlighted under the pointer (SelectableEntry.mouseOverRightHalf / TopLeftQuarter / BottomLeftQuarter). In mouseClicked, the right half joins, and the left quarters swap the server with its neighbour (ServerList.swap, saved) and keep it selected.
  • All of the row's text goes through GuiGraphicsExtractor.text(font, …, color), which draws a drop shadow. Horizon drew it flat.

Changes

  • multiplayer.rs:
    • Ping::Ok carries the MOTD as Text (component::to_text, then resolve_legacy when drawn) and the player numbers.
    • A per-address icon cache is seeded from servers.dat and refreshed by each ping.
    • A new or invalid favicon is written back to servers.dat. Moves and deletes keep the icons a ping saved meanwhile, and a lock guards servers.dat writes.
    • Icons are drawn through the world-icon atlas slots, the way the world list draws them.
  • front.rs (Horizon's own list) reads the new fields.
  • title.rs passes the cursor to the multiplayer screen for hovering.
  • Not included:
    • #379 (ping tooltip on the bars): Online5277's #403, already on main. This PR builds on it (its test now uses the new Ping::Ok fields).
    • The incompatible-version state (red version, incompatible icon) and the player-sample tooltip: not filed.

How it was verified

  • Unit tests: player_count_is_dark_gray_with_gray_numbers (the component JSON), favicons_are_64_pixel_pngs_behind_the_data_url (prefix, \n stripping, size check) and icon_arrows_join_and_move_servers (top-left/bottom-left move and save, right half joins, no up arrow on the first row).
  • In game, offscreen against a local --dedicated server with a 64×64 server-icon.png and motd=§aGreen §lBold§r and §cred\n§6Second §oline:
    • icon, styled two-line MOTD and 0/20 (pixels AAAAAA digits, 555555 slash) all show;
    • hovering the second row shows up/down/join with the hovered arrow highlighted;
    • clicking its down arrow moves it, keeps it selected and saves servers.dat (the order and icon survive a restart).

Self-check (combined branch of the batch's seven PRs, #406 #407 #409 #414 #416 #421 #423, on origin/main d28521f7; Mac mini):

  • cargo fmt --all --check: ok
  • cargo clippy --workspace --all-targets -- -D warnings: ok
  • cargo test -p horizon-client: 775 passed, 0 failed
  • tools/parity.py --changed origin/main (82 harnesses, including the new world_reopen): 82 pass.
    • The first pass found two #407 regressions, both fixed in #407 and rerun green: command_parse (suggestions were pruned in brigadier itself rather than only in the player's chat) and dedicated_server (dedicated-server guests lost their ops-based commands).
    • 34 harnesses passed on the combined commit before those two #407 fixes. The other 48 plus the two reruns passed after them.
  • Not run: the Linux and Windows checks (this batch was developed and checked on the Mac mini only).

🤖 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/421 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/16/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/server-list-entries` --- ### 📝 Commits (1) - [`37f6481`](https://github.com/horizon-rust/horizon/commit/37f6481e14323e4696f3134b5aae5d8dc228227a) Server list rows: favicons, styled MOTDs, player count colours, icon arrows ### 📊 Changes **3 files changed** (+333 additions, -62 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/front.rs` (+8 -2) 📝 `crates/horizon-client/src/multiplayer.rs` (+324 -60) 📝 `crates/horizon-client/src/title.rs` (+1 -0) </details> ### 📄 Description Fixes #365 Fixes #378 Fixes #370 Server list rows now draw what vanilla's `ServerSelectionList.OnlineServerEntry.extractContent` draws. **What vanilla does** - **Icon (#365).** `ServerStatusPinger` reads `ServerStatus.Favicon` (a `data:image/png;base64,` URL) into `ServerData.setIconBytes`. `OnlineServerEntry.uploadServerIcon` hands it to `FaviconTexture.upload`, which only takes 64×64 PNGs. The bytes are saved in servers.dat (`updateServerList`), so the icon shows before the next ping. - **MOTD formatting (#365).** `data.motd = sanitizeDescription(status.description())` is a styled component. The font also applies legacy `§` codes inside it (`StringDecomposer.iterateFormatted`). It is split to `contentWidth - 34` and at most two lines are drawn. - **Player count (#378).** `ServerStatusPinger.formatPlayerCount` draws `multiplayer.status.player_count` in DARK_GRAY with both numbers in GRAY, or `multiplayer.status.unknown` when the status has no `players`. - **Hover icons (#370).** A hovered row gets a `0xA0909090` fill over the icon plus the `server_list/join` arrow, `move_up` (when not first) and `move_down` (when not last). Each is `_highlighted` under the pointer (`SelectableEntry.mouseOverRightHalf` / `TopLeftQuarter` / `BottomLeftQuarter`). In `mouseClicked`, the right half joins, and the left quarters swap the server with its neighbour (`ServerList.swap`, saved) and keep it selected. - All of the row's text goes through `GuiGraphicsExtractor.text(font, …, color)`, which draws a drop shadow. Horizon drew it flat. **Changes** - `multiplayer.rs`: - `Ping::Ok` carries the MOTD as `Text` (`component::to_text`, then `resolve_legacy` when drawn) and the player numbers. - A per-address icon cache is seeded from servers.dat and refreshed by each ping. - A new or invalid favicon is written back to servers.dat. Moves and deletes keep the icons a ping saved meanwhile, and a lock guards servers.dat writes. - Icons are drawn through the world-icon atlas slots, the way the world list draws them. - `front.rs` (Horizon's own list) reads the new fields. - `title.rs` passes the cursor to the multiplayer screen for hovering. - Not included: - #379 (ping tooltip on the bars): Online5277's #403, already on main. This PR builds on it (its test now uses the new `Ping::Ok` fields). - The incompatible-version state (red version, `incompatible` icon) and the player-sample tooltip: not filed. **How it was verified** - Unit tests: `player_count_is_dark_gray_with_gray_numbers` (the component JSON), `favicons_are_64_pixel_pngs_behind_the_data_url` (prefix, `\n` stripping, size check) and `icon_arrows_join_and_move_servers` (top-left/bottom-left move and save, right half joins, no up arrow on the first row). - In game, offscreen against a local `--dedicated` server with a 64×64 `server-icon.png` and `motd=§aGreen §lBold§r and §cred\n§6Second §oline`: - icon, styled two-line MOTD and `0/20` (pixels AAAAAA digits, 555555 slash) all show; - hovering the second row shows up/down/join with the hovered arrow highlighted; - clicking its down arrow moves it, keeps it selected and saves servers.dat (the order and icon survive a restart). **Self-check** (combined branch of the batch's seven PRs, #406 #407 #409 #414 #416 #421 #423, on origin/main d28521f7; Mac mini): - `cargo fmt --all --check`: ok - `cargo clippy --workspace --all-targets -- -D warnings`: ok - `cargo test -p horizon-client`: 775 passed, 0 failed - `tools/parity.py --changed origin/main` (82 harnesses, including the new `world_reopen`): 82 pass. - The first pass found two #407 regressions, both fixed in #407 and rerun green: `command_parse` (suggestions were pruned in brigadier itself rather than only in the player's chat) and `dedicated_server` (dedicated-server guests lost their ops-based commands). - 34 harnesses passed on the combined commit before those two #407 fixes. The other 48 plus the two reruns passed after them. - Not run: the Linux and Windows checks (this batch was developed and checked on the Mac mini only). 🤖 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:08 +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#2552
No description provided.