[PR #2300] [MERGED] mods: browser, a recipe viewer's item panel (API level 6) #4184

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

📋 Pull Request Information

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

Base: main ← Head: feat/mod-item-panel-api


📝 Commits (3)

  • aa839fa mods: browser, a recipe viewer's item panel (API level 5)
  • b8da45f mods: browser's page event names the first recipe shown, set-recipes' indexes are its list's
  • b836eea Merge #2284 (recipes now at API level 5): browser moves to level 6

📊 Changes

10 files changed (+344 additions, -12 deletions)

View changed files

📝 crates/horizon-mod-sdk/src/lib.rs (+3 -1)
📝 crates/horizon-mod-sdk/wit/horizon.wit (+58 -0)
📝 crates/horizon-mods/src/api_level.rs (+4 -2)
📝 crates/horizon-mods/src/manifest.rs (+4 -0)
📝 crates/horizon-mods/src/runtime.rs (+85 -2)
📝 crates/horizon-mods/tests/sandbox.rs (+67 -2)
📝 crates/horizon-mods/tests/ui_guest/src/lib.rs (+57 -1)
📝 docs/api/mods-reference.md (+64 -2)
📝 docs/api/stability.md (+1 -1)
📝 docs/mods.md (+1 -1)

📄 Description

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

Part B1a of the recipe-viewer plan: the mod API side of the item panel. The official recipe viewer mod is written from vanilla 26.3's recipe book and Horizon's own design. Stacked on #2284 (capability recipes). Merge #2284 first; this PR's base moves to main after that.

What it adds

A new WIT interface, browser, under capability ui (experimental), at API level 6:

  • set-items(list<stack>): the items of a panel the game shows right of the inventory and container screens. Each stack is an item id, a count and components in vanilla's item syntax. An empty list hides the panel. At most 8,192 items are kept.
  • poll() -> list<event>: what the player did since the last poll, at most 256 events kept:
    • clicked: an item of the panel, by index, left or right.
    • search: the search box's text.
    • key: one of the mod's own keys (input.register-key) pressed over an item, a slot's or the panel's, with that stack.
    • slot-clicked, action, page, back: for the recipe pages coming in B2 (set-recipes). They are in the variant now because adding cases later would break mods built against it.

The game side (drawing, paging, the search box, the hooks) is the next PR. Nothing changes for players until then.

Checks

  • browser_lists_items_and_hears_the_player (sandbox) covers:
    • the panel's items and their components, and a new version on each set-items;
    • an empty list hides the panel;
    • clicks, search, and keys on the mod's own binding (another key is ignored);
    • the 256-event cap.
  • api_reference passes; mods-reference.md is regenerated.

🤖 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/2300 **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-item-panel-api` --- ### 📝 Commits (3) - [`aa839fa`](https://github.com/horizon-rust/horizon/commit/aa839fa99a28e2649d31d807bc032942a4ec739e) mods: browser, a recipe viewer's item panel (API level 5) - [`b8da45f`](https://github.com/horizon-rust/horizon/commit/b8da45f5ef2d4b1b1584b0255b36ef389ac18a10) mods: browser's page event names the first recipe shown, set-recipes' indexes are its list's - [`b836eea`](https://github.com/horizon-rust/horizon/commit/b836eea0627aed69730392d41413cb19f536208a) Merge #2284 (recipes now at API level 5): browser moves to level 6 ### 📊 Changes **10 files changed** (+344 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-mod-sdk/src/lib.rs` (+3 -1) 📝 `crates/horizon-mod-sdk/wit/horizon.wit` (+58 -0) 📝 `crates/horizon-mods/src/api_level.rs` (+4 -2) 📝 `crates/horizon-mods/src/manifest.rs` (+4 -0) 📝 `crates/horizon-mods/src/runtime.rs` (+85 -2) 📝 `crates/horizon-mods/tests/sandbox.rs` (+67 -2) 📝 `crates/horizon-mods/tests/ui_guest/src/lib.rs` (+57 -1) 📝 `docs/api/mods-reference.md` (+64 -2) 📝 `docs/api/stability.md` (+1 -1) 📝 `docs/mods.md` (+1 -1) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Part B1a of the recipe-viewer plan: the mod API side of the item panel. The official recipe viewer mod is written from vanilla 26.3's recipe book and Horizon's own design. Stacked on #2284 (capability `recipes`). Merge #2284 first; this PR's base moves to main after that. ## What it adds A new WIT interface, `browser`, under capability `ui` (experimental), at API level 6: - `set-items(list<stack>)`: the items of a panel the game shows right of the inventory and container screens. Each stack is an item id, a count and components in vanilla's item syntax. An empty list hides the panel. At most 8,192 items are kept. - `poll() -> list<event>`: what the player did since the last poll, at most 256 events kept: - `clicked`: an item of the panel, by index, left or right. - `search`: the search box's text. - `key`: one of the mod's own keys (`input.register-key`) pressed over an item, a slot's or the panel's, with that stack. - `slot-clicked`, `action`, `page`, `back`: for the recipe pages coming in B2 (`set-recipes`). They are in the variant now because adding cases later would break mods built against it. The game side (drawing, paging, the search box, the hooks) is the next PR. Nothing changes for players until then. ## Checks - `browser_lists_items_and_hears_the_player` (sandbox) covers: - the panel's items and their components, and a new version on each `set-items`; - an empty list hides the panel; - clicks, search, and keys on the mod's own binding (another key is ignored); - the 256-event cap. - `api_reference` passes; mods-reference.md is regenerated. 🤖 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:15: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#4184
No description provided.