mods: browser's page event names the first recipe shown, set-recipes' indexes are its list's

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-26 17:51:32 +01:00
parent aa839fa99a
commit b8da45f5ef
3 changed files with 13 additions and 11 deletions
+8 -6
View File
@@ -533,10 +533,10 @@ interface browser {
key: string,
stack: stack,
}
/// A click on a slot of the recipe the panel shows (`set-recipes`).
/// A click on a slot of a recipe the panel shows (`set-recipes`).
record slot-click {
/// The recipe's index on the page and the slot's in it; the
/// results come after the slots.
/// The recipe's index in `set-recipes`'s list and the slot's in
/// it; the results come after the slots.
recipe: u32,
slot: u32,
/// The stack the slot showed at that moment.
@@ -549,10 +549,12 @@ interface browser {
search(string),
key(item-key),
slot-clicked(slot-click),
/// The action button of the recipe at this index on the page.
/// The action button of the recipe at this index in
/// `set-recipes`'s list.
action(u32),
/// The page arrows of `set-recipes`: -1 or 1.
page(s32),
/// The player turned the recipes' page (`set-recipes`): the index
/// of the first recipe now shown.
page(u32),
/// The back button of `set-recipes`.
back,
}
@@ -330,7 +330,7 @@ impl Mod for Guest {
format!("slot {} {} {}", c.recipe, c.slot, stack(&c.stack))
}
browser::Event::Action(i) => format!("action {i}"),
browser::Event::Page(step) => format!("page {step}"),
browser::Event::Page(first) => format!("page {first}"),
browser::Event::Back => "back".into(),
});
}
+4 -4
View File
@@ -567,11 +567,11 @@ A key the mod registered (`input.register-key`) went down while the pointer was
### record `slot-click`
A click on a slot of the recipe the panel shows (`set-recipes`).
A click on a slot of a recipe the panel shows (`set-recipes`).
| Field | Type | |
| --- | --- | --- |
| `recipe` | `u32` | The recipe's index on the page and the slot's in it; the results come after the slots. |
| `recipe` | `u32` | The recipe's index in `set-recipes`'s list and the slot's in it; the results come after the slots. |
| `slot` | `u32` | |
| `stack` | `stack` | The stack the slot showed at that moment. |
| `right` | `bool` | |
@@ -584,8 +584,8 @@ A click on a slot of the recipe the panel shows (`set-recipes`).
| `search` | `string` | The search box's text, each time the player changes it. |
| `key` | `item-key` | |
| `slot-clicked` | `slot-click` | |
| `action` | `u32` | The action button of the recipe at this index on the page. |
| `page` | `s32` | The page arrows of `set-recipes`: -1 or 1. |
| `action` | `u32` | The action button of the recipe at this index in `set-recipes`'s list. |
| `page` | `u32` | The player turned the recipes' page (`set-recipes`): the index of the first recipe now shown. |
| `back` | | The back button of `set-recipes`. |
| Function | Signature | What it does |