[PR #2056] [MERGED] Mod API: render.set-minimap, a map the game keeps in a corner #3973

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

📋 Pull Request Information

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

Base: main ← Head: feat/mod-minimap-api


📝 Commits (2)

  • 24ab642 Mod API: render.set-minimap, a map the game keeps in a corner
  • 641ff51 Merge main into feat/mod-minimap-api

📊 Changes

9 files changed (+169 additions, -18 deletions)

View changed files

📝 crates/horizon-client/src/game/extras.rs (+33 -15)
📝 crates/horizon-client/src/game/mod_input.rs (+31 -0)
📝 crates/horizon-mod-sdk/wit/horizon.wit (+21 -0)
📝 crates/horizon-mods/src/runtime.rs (+23 -2)
📝 crates/horizon-mods/tests/sandbox.rs (+26 -0)
📝 crates/horizon-mods/tests/ui_guest/src/lib.rs (+19 -0)
📝 docs/api/mods-reference.md (+11 -0)
📝 docs/api/stability.md (+4 -0)
📝 docs/mods.md (+1 -1)

📄 Description

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

The minimap is the fourth extra to move to the mod browser, after the FPS counter, Keystrokes and Zoom. This PR adds the API the official Minimap mod needs; the mod follows in a stacked PR.

What a modder can do now

render.set-minimap(option<minimap>) shows a map of the world around the player until the next call, and none hides it. The mod chooses:

  • corner: where the map goes. It stacks with the game's overlays and the mods' panels, as set-corner boxes do.
  • size: its side in GUI pixels, 16 to 256.
  • blocks-per-pixel: 0.5 to 4, on a 128 × 128 image.
  • rotate: the map turns with the player, with an N on its rim. Otherwise north is up and the arrow turns.
  • round or square.

The game draws it exactly as the minimap extra does, from the same code:

  • vanilla's map colours, with the map item's height shading and water-depth dithering;
  • underground, under a roof and in the Nether, the floor around the player's height;
  • the map decoration arrow;
  • tiles refreshed within the extra's 0.3 ms frame budget, and dropped when no map shows.

One map shows at a time: the first loaded mod's. The extra, while it still exists, wins over a mod.

Why the game draws it

Making a map image means reading thousands of blocks a frame, and through hook calls that would cost far more than the extra does today. So the game keeps the tiles and the mod picks how the map looks. This choice is written in docs/api/stability.md ("The experimental mod APIs' choices").

It is a new function and a new record, with no existing WIT type changed. Mods built before it keep loading: the published FPS Counter, Keystrokes and Zoom run on this build beside the Minimap mod, in both modes.

How tested

  • Sandbox test render_minimap_is_clamped_and_hidden: corner, size, scale, rotate and round come through; the size and scale are clamped, NaN gives the smallest value, and none hides the map. The test guest gained a minimap command.
  • In game, through the Minimap mod on this API, compared with the extra on the same build: identical pixels in the map region. Numbers are in the mod's PR.
  • docs/api/mods-reference.md is regenerated, and docs/mods.md's render row lists the function.

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 45bd296f1, 3 min 19 s)

Check Result
Scope ✅ 9 files, +169 −18
Cargo.lock ✅ unchanged
Public tree ✅ (1 s)
Python tests ➖ no Python change
rustfmt ✅ (7 s)
clippy ✅ (34 s)
tests: horizon-client, horizon-mod-sdk, horizon-mods, horizon-mods-test-ui-guest ✅ 1353 passed (1 min 39 s)
doc tests ✅ 1 passed (38 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ✅ (1 s)
launcher clippy ✅ (4 s)
launcher tests ✅ 129 passed (12 s)
Parity ➖ 29 affected, to run in CI (--quick): arrow, block_removal, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, hardcore_respawn, locator_bar, mace, online_mode and 17 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

skip-release: API only; players see no change until the Minimap mod ships.

🤖 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/2056 **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/mod-minimap-api` --- ### 📝 Commits (2) - [`24ab642`](https://github.com/horizon-rust/horizon/commit/24ab642e7bc79eea0cd97d99a7abcf1c5049f9ea) Mod API: render.set-minimap, a map the game keeps in a corner - [`641ff51`](https://github.com/horizon-rust/horizon/commit/641ff510894c795cb82a7a97f2fddcd58ac5e701) Merge main into feat/mod-minimap-api ### 📊 Changes **9 files changed** (+169 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/extras.rs` (+33 -15) 📝 `crates/horizon-client/src/game/mod_input.rs` (+31 -0) 📝 `crates/horizon-mod-sdk/wit/horizon.wit` (+21 -0) 📝 `crates/horizon-mods/src/runtime.rs` (+23 -2) 📝 `crates/horizon-mods/tests/sandbox.rs` (+26 -0) 📝 `crates/horizon-mods/tests/ui_guest/src/lib.rs` (+19 -0) 📝 `docs/api/mods-reference.md` (+11 -0) 📝 `docs/api/stability.md` (+4 -0) 📝 `docs/mods.md` (+1 -1) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. The minimap is the fourth extra to move to the mod browser, after the FPS counter, Keystrokes and Zoom. This PR adds the API the official Minimap mod needs; the mod follows in a stacked PR. ## What a modder can do now `render.set-minimap(option<minimap>)` shows a map of the world around the player until the next call, and `none` hides it. The mod chooses: - `corner`: where the map goes. It stacks with the game's overlays and the mods' panels, as `set-corner` boxes do. - `size`: its side in GUI pixels, 16 to 256. - `blocks-per-pixel`: 0.5 to 4, on a 128 × 128 image. - `rotate`: the map turns with the player, with an N on its rim. Otherwise north is up and the arrow turns. - `round` or square. The game draws it exactly as the minimap extra does, from the same code: - vanilla's map colours, with the map item's height shading and water-depth dithering; - underground, under a roof and in the Nether, the floor around the player's height; - the map decoration arrow; - tiles refreshed within the extra's 0.3 ms frame budget, and dropped when no map shows. One map shows at a time: the first loaded mod's. The extra, while it still exists, wins over a mod. ## Why the game draws it Making a map image means reading thousands of blocks a frame, and through hook calls that would cost far more than the extra does today. So the game keeps the tiles and the mod picks how the map looks. This choice is written in `docs/api/stability.md` ("The experimental mod APIs' choices"). It is a new function and a new record, with no existing WIT type changed. Mods built before it keep loading: the published FPS Counter, Keystrokes and Zoom run on this build beside the Minimap mod, in both modes. ## How tested - **Sandbox test** `render_minimap_is_clamped_and_hidden`: corner, size, scale, rotate and round come through; the size and scale are clamped, NaN gives the smallest value, and `none` hides the map. The test guest gained a `minimap` command. - **In game**, through the Minimap mod on this API, compared with the extra on the same build: identical pixels in the map region. Numbers are in the mod's PR. - `docs/api/mods-reference.md` is regenerated, and `docs/mods.md`'s `render` row lists the function. **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 45bd296f1, 3 min 19 s) | Check | Result | | --- | --- | | Scope | ✅ 9 files, +169 −18 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ (1 s) | | Python tests | ➖ no Python change | | rustfmt | ✅ (7 s) | | clippy | ✅ (34 s) | | tests: horizon-client, horizon-mod-sdk, horizon-mods, horizon-mods-test-ui-guest | ✅ 1353 passed (1 min 39 s) | | doc tests | ✅ 1 passed (38 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ✅ (1 s) | | launcher clippy | ✅ (4 s) | | launcher tests | ✅ 129 passed (12 s) | | Parity | ➖ 29 affected, to run in CI (--quick): arrow, block_removal, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, hardcore_respawn, locator_bar, mace, online_mode and 17 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | `skip-release`: API only; players see no change until the Minimap mod ships. 🤖 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:41 +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#3973
No description provided.