[PR #1995] [MERGED] Extras: the FPS counter and keystrokes move to the mod browser #3923

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

📋 Pull Request Information

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

Base: main ← Head: feat/moved-hud-extras


📝 Commits (4)

  • 22980fc Extras: the FPS counter and keystrokes move to the mod browser
  • ba105e0 Merge branch 'feat/official-hud-mods' into feat/moved-hud-extras
  • 90a9d9c Merge main into feat/moved-hud-extras
  • 828a251 Merge main into feat/moved-hud-extras

📊 Changes

10 files changed (+390 additions, -236 deletions)

View changed files

📝 crates/horizon-client/Cargo.toml (+1 -1)
📝 crates/horizon-client/src/extras.rs (+25 -48)
📝 crates/horizon-client/src/extras_hud.rs (+3 -133)
📝 crates/horizon-client/src/game.rs (+3 -0)
📝 crates/horizon-client/src/game/extras.rs (+11 -39)
📝 crates/horizon-client/src/game/mods.rs (+3 -0)
➕ crates/horizon-client/src/game/moved_extras.rs (+115 -0)
📝 crates/horizon-client/src/lib.rs (+1 -0)
➕ crates/horizon-client/src/moved_extras.rs (+214 -0)
📝 docs/extras.md (+14 -15)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Stacked on #1982 (the official FPS Counter and Keystrokes mods), itself on #1963, #1944 and #1929. Review only the last commit. Until those merge, the diff also shows their commits. Merge this only once both mods are published in the registry (horizon-mods): before that, players who had the extras on get the "tries again" line instead.

What players see

The FPS counter and Keystrokes leave Options > Horizon Extras: they are official mods in the mod browser now, with the same look and options (#1982).

  • Had one on: on the first start after the update, the game installs the mod from Horizon's registry, turns it on and carries the extra's corner and options over. The chat says, once: "FPS counter moved to the mod browser: installed for you" (and the same for Keystrokes). The overlay looks exactly as it did.
  • Offline, or the registry can't be reached: the chat says "FPS counter moved to the mod browser; it couldn't be installed for you yet, Horizon tries again at the next start". Nothing is marked done, so the next start tries again.
  • Had them off: nothing is installed and nothing is said. The mods are in the mod browser for anyone who wants them.

How the migration works

  • moved_extras.rs (lib):
    • MOVED lists the extra → mod pairs.
    • pending holds those that were on and not done; nothing_to_do those that were off.
    • install takes the mod's newest version for 26.3 that wasn't taken down. It downloads it only if the file isn't already there with that hash.
    • It checks the file with horizon_mods::index::check_file, the launcher's own check (size, SHA-256, signature, manifest against the index), and moves it to horizon-mods/<id>.hmod.
    • It writes the extra's settings into the mod's storage. A key the mod already has is left alone, so a later reinstall never overwrites the player's mod settings.
    • Finally it turns the mod on in horizon-mods.txt.
  • game/moved_extras.rs (needs the mods feature, as every release has):
    • At start, before the mods load, it marks the extras that were off and starts a thread for the rest: index, download, check, install.
    • Each frame it collects the result: it marks the installed ones, turns them on in the in-memory list too (so a later settings save keeps them), restarts the mods, and shows the lines once a world is open.
  • horizon-extras.txt keeps the old fps* / keystrokes* keys and gains movedToMods:fps_overlay,keystrokes. The registry address follows HORIZON_MOD_INDEX, as the launcher's does, for trial registries.
  • The frame and click counters now run only while a mod runs (for render.frame-stats and input.clicks-per-second). The built-in drawing (draw_fps, draw_keystrokes) and the six Extras rows are gone. docs/extras.md says where they went.

How tested

  • Unit tests:
    • moved_extras: only extras that were on are installed, each once, with the right settings and line.
    • file:// is refused without a local index.
    • The extras round trip with movedToMods, and the Extras page rows.
  • In game: a trial registry built with cargo horizon-mod registry build from the two entries going to horizon-mods, with file:// downloads, HORIZON_MOD_INDEX pointing at it, fresh HORIZON_HOME and XDG folders, and HORIZON_NO_AUDIO=1. 17/17 checks:
    • A: FPS on (top right, with lows) and Keystrokes on (no CPS).
      • Both mods are installed, checked and turned on, and both lines show in the chat.
      • Storage holds corner=top_right/lows=true and corner=top_left/cps=false, and movedToMods lists both.
      • The overlays show in those corners. A second start says nothing more.
    • B: FPS on, no index (offline). The chat shows the retry line and nothing is marked. The next start with the index installs the mod.
    • C: both off. Nothing is installed, and both are marked.
    • No panic and no stopped mod in any run.
  • The hashes rebuilt in this worktree match #1982's (58a4f5d0…, 5eb2e786…): the build is reproducible from a different checkout path.

Self-check (against #1982's head; the 597 lines are mostly the removed drawing and rows):

pr_ready (tools/pr_ready.py --quick --base fbd6bee3e on ludovics-mac-mini, against fbd6bee3e at fbd6bee3e, 15 min 12 s)

Check Result
Scope ⚠️ 10 files, +390 −236; 597 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (29 s)
clippy ✅ (17 s)
tests: horizon-client ✅ 1237 passed (13 min 20 s)
doc tests ✅ 0 passed (6 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 107 affected, to run in CI (--quick): ambient_sound, arrow, audio_attributes, auto_jump, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal, block_transformer, breaking_model, camera and 95 more

No label: players see a change (release notes: "FPS counter and Keystrokes moved to the mod browser; if you had one on, it's installed for you").

Leftovers

  • The launcher doesn't record these installs in its mod-browser.json. Its Mods tab doesn't list them (the game's Options > Mods does) and won't offer their updates. Next step: the launcher adopts files in horizon-mods/ whose SHA-256 matches a registry version.
  • Builds without the mods feature (dev builds, the server) just lose the two extras.

🤖 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/1995 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/moved-hud-extras` --- ### 📝 Commits (4) - [`22980fc`](https://github.com/horizon-rust/horizon/commit/22980fc8ccab18df7e3f9eacb5419d211e30adc6) Extras: the FPS counter and keystrokes move to the mod browser - [`ba105e0`](https://github.com/horizon-rust/horizon/commit/ba105e07845a5c05c0c2b4154434dfb4c4260d98) Merge branch 'feat/official-hud-mods' into feat/moved-hud-extras - [`90a9d9c`](https://github.com/horizon-rust/horizon/commit/90a9d9c6120d2569c2310044fd1e7e850ebb8add) Merge main into feat/moved-hud-extras - [`828a251`](https://github.com/horizon-rust/horizon/commit/828a2519e1000f3aa52102abd9e6505e75342a90) Merge main into feat/moved-hud-extras ### 📊 Changes **10 files changed** (+390 additions, -236 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/Cargo.toml` (+1 -1) 📝 `crates/horizon-client/src/extras.rs` (+25 -48) 📝 `crates/horizon-client/src/extras_hud.rs` (+3 -133) 📝 `crates/horizon-client/src/game.rs` (+3 -0) 📝 `crates/horizon-client/src/game/extras.rs` (+11 -39) 📝 `crates/horizon-client/src/game/mods.rs` (+3 -0) ➕ `crates/horizon-client/src/game/moved_extras.rs` (+115 -0) 📝 `crates/horizon-client/src/lib.rs` (+1 -0) ➕ `crates/horizon-client/src/moved_extras.rs` (+214 -0) 📝 `docs/extras.md` (+14 -15) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. **Stacked on #1982** (the official FPS Counter and Keystrokes mods), itself on #1963, #1944 and #1929. Review only the last commit. Until those merge, the diff also shows their commits. Merge this only once both mods are published in the registry (horizon-mods): before that, players who had the extras on get the "tries again" line instead. ## What players see The **FPS counter** and **Keystrokes** leave Options > Horizon Extras: they are official mods in the mod browser now, with the same look and options (#1982). - **Had one on:** on the first start after the update, the game installs the mod from Horizon's registry, turns it on and carries the extra's corner and options over. The chat says, once: "FPS counter moved to the mod browser: installed for you" (and the same for Keystrokes). The overlay looks exactly as it did. - **Offline, or the registry can't be reached:** the chat says "FPS counter moved to the mod browser; it couldn't be installed for you yet, Horizon tries again at the next start". Nothing is marked done, so the next start tries again. - **Had them off:** nothing is installed and nothing is said. The mods are in the mod browser for anyone who wants them. ## How the migration works - `moved_extras.rs` (lib): - `MOVED` lists the extra → mod pairs. - `pending` holds those that were on and not done; `nothing_to_do` those that were off. - `install` takes the mod's newest version for 26.3 that wasn't taken down. It downloads it only if the file isn't already there with that hash. - It checks the file with `horizon_mods::index::check_file`, the launcher's own check (size, SHA-256, signature, manifest against the index), and moves it to `horizon-mods/<id>.hmod`. - It writes the extra's settings into the mod's storage. A key the mod already has is left alone, so a later reinstall never overwrites the player's mod settings. - Finally it turns the mod on in `horizon-mods.txt`. - `game/moved_extras.rs` (needs the `mods` feature, as every release has): - At start, before the mods load, it marks the extras that were off and starts a thread for the rest: index, download, check, install. - Each frame it collects the result: it marks the installed ones, turns them on in the in-memory list too (so a later settings save keeps them), restarts the mods, and shows the lines once a world is open. - `horizon-extras.txt` keeps the old `fps*` / `keystrokes*` keys and gains `movedToMods:fps_overlay,keystrokes`. The registry address follows `HORIZON_MOD_INDEX`, as the launcher's does, for trial registries. - The frame and click counters now run only while a mod runs (for `render.frame-stats` and `input.clicks-per-second`). The built-in drawing (`draw_fps`, `draw_keystrokes`) and the six Extras rows are gone. `docs/extras.md` says where they went. ## How tested - **Unit tests:** - `moved_extras`: only extras that were on are installed, each once, with the right settings and line. - `file://` is refused without a local index. - The extras round trip with `movedToMods`, and the Extras page rows. - **In game:** a trial registry built with `cargo horizon-mod registry build` from the two entries going to horizon-mods, with `file://` downloads, `HORIZON_MOD_INDEX` pointing at it, fresh `HORIZON_HOME` and XDG folders, and `HORIZON_NO_AUDIO=1`. 17/17 checks: - **A:** FPS on (top right, with lows) and Keystrokes on (no CPS). - Both mods are installed, checked and turned on, and both lines show in the chat. - Storage holds `corner=top_right`/`lows=true` and `corner=top_left`/`cps=false`, and `movedToMods` lists both. - The overlays show in those corners. A second start says nothing more. - **B:** FPS on, no index (offline). The chat shows the retry line and nothing is marked. The next start with the index installs the mod. - **C:** both off. Nothing is installed, and both are marked. - No panic and no stopped mod in any run. - The hashes rebuilt in this worktree match #1982's (`58a4f5d0…`, `5eb2e786…`): the build is reproducible from a different checkout path. **Self-check** (against #1982's head; the 597 lines are mostly the removed drawing and rows): **pr_ready** (`tools/pr_ready.py --quick --base fbd6bee3e` on ludovics-mac-mini, against fbd6bee3e at fbd6bee3e, 15 min 12 s) | Check | Result | | --- | --- | | Scope | ⚠️ 10 files, +390 −236; 597 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (29 s) | | clippy | ✅ (17 s) | | tests: horizon-client | ✅ 1237 passed (13 min 20 s) | | doc tests | ✅ 0 passed (6 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 107 affected, to run in CI (--quick): ambient_sound, arrow, audio_attributes, auto_jump, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal, block_transformer, breaking_model, camera and 95 more | No label: players see a change (release notes: "FPS counter and Keystrokes moved to the mod browser; if you had one on, it's installed for you"). ## Leftovers - The launcher doesn't record these installs in its `mod-browser.json`. Its Mods tab doesn't list them (the game's Options > Mods does) and won't offer their updates. Next step: the launcher adopts files in `horizon-mods/` whose SHA-256 matches a registry version. - Builds without the `mods` feature (dev builds, the server) just lose the two extras. 🤖 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-03 04:13:17 +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#3923
No description provided.