Improve recipe viewer

This commit is contained in:
2026-10-03 13:41:01 -03:00
parent 50d47cedef
commit ecc0295f6d
12 changed files with 666 additions and 452 deletions
+17 -3
View File
@@ -8,6 +8,9 @@ export interface ClientContext {
ui: ClientUi;
hud: HudRegistry;
input: { bind(id: Id, default_key: KeyCode, on_press: () => void): void };
// the player's settings, read only, like minecraft's Options. a screen closes on key_inventory like the inventory,
// the way jei's recipes screen checks options.keyInventory
options: KeyMappings;
net: ClientNet;
// is_swimming: lying flat in water in the 0.8 tall box, like minecraft's isSwimming
player: { readonly name: string; readonly position: Readonly<Position>; is_swimming(): boolean };
@@ -36,6 +39,20 @@ export interface ClientContext {
log(...args: unknown[]): void;
}
// the keys the player has bound, like the key mappings in minecraft's Options
export interface KeyMappings {
readonly key_forward: KeyCode;
readonly key_back: KeyCode;
readonly key_left: KeyCode;
readonly key_right: KeyCode;
readonly key_jump: KeyCode;
readonly key_sprint: KeyCode;
readonly key_sneak: KeyCode;
readonly key_inventory: KeyCode;
readonly key_drop: KeyCode;
readonly key_chat: KeyCode;
}
// a screen with no menu, only on this client, like neoforge's Screen. see docs/modding/gui/index.md
export interface Screen {
// when it opens, and whenever the window changes size. in gui pixels
@@ -115,9 +132,6 @@ export interface Graphics {
// list. it gets the screen's box to lay itself out around
export interface InventoryOverlay {
on_render(g: Graphics, screen: InventoryScreenView): void;
// while it's true the screen underneath isn't drawn or clicked, panels outside its box included, for something
// drawn in its place like the recipe viewer's recipes. asked every frame, before on_render
hides_screen?(): boolean;
// the screen closed for any reason, like the player closing their inventory
on_close?(): void;
}