Change curios to always show on inventory

This commit is contained in:
2026-10-01 16:35:41 -03:00
parent deba36260e
commit 3dc7d2adee
24 changed files with 244 additions and 159 deletions
+2
View File
@@ -119,6 +119,8 @@ export interface InventoryOverlay {
}
export interface InventoryScreenView {
// the open menu's type, like "bworld:furnace". undefined on the player's own inventory
readonly menu_type: Id | undefined;
readonly x: number;
readonly y: number;
readonly width: number;
+10
View File
@@ -388,7 +388,17 @@ export interface MenuType<Args> {
open(player: Player, args: Args): MenuHandle;
}
// the player's own inventory menu, see MenuRegistry.extend_player_menu
export interface PlayerMenuBuilder {
// x and y are from the inventory screen's top left, and can be outside it, like left of it with a negative x. the
// engine draws a panel behind slots outside its own. returns the menu slot index, from 46 on
add_slot(container: Container, slot: number, options: SlotOptions): number;
}
export interface MenuRegistry {
// adds slots to every player's own inventory menu, always there while they play, like curios' slots next to the
// inventory. build runs when each player joins. only during setup
extend_player_menu(build: (menu: PlayerMenuBuilder, player: Player) => void): void;
// like registering a MenuType. the client script gives it a screen with ctx.ui.register_menu_screen
register<Args = undefined>(
id: Id,
+10 -5
View File
@@ -7,7 +7,7 @@ export const AIR_ID = "bworld:air";
// bump when a client and server of different versions can't play together.
// the server rejects a different version before the client downloads anything
export const PROTOCOL_VERSION = 14;
export const PROTOCOL_VERSION = 15;
export interface PlayerInfo {
id: string;
@@ -52,16 +52,19 @@ export type EntityEvent = "hurt" | "death" | "swing";
// x, y, z, block id, and its state bits when they aren't 0
export type BlockChange = [number, number, number, string, number?];
// the player's own containers, synced to them whether or not a menu is open
export type ContainerKey = "inventory" | "crafting";
// the player's own containers, synced to them whether or not a menu is open. "extra" is what's in the slots mods added
// to menu 0, like curios', in their order
export type ContainerKey = "inventory" | "crafting" | "extra";
export const CRAFTING_RESULT_SLOT = 9;
// menus, like neoforge's: the server's menu decides what every click does, clients draw it and send clicks by menu
// slot index. menu 0 is the player's own inventory and crafting grid, always there and never opened or sent, like
// minecraft's InventoryMenu: slots 0-35 are the inventory (the hotbar is 0-8), 36-45 the crafting grid
// slot index. menu 0 is the player's own inventory and crafting grid, always there and never opened, like minecraft's
// InventoryMenu: slots 0-35 are the inventory (the hotbar is 0-8), 36-45 the crafting grid, then the slots mods added,
// which join's player_menu lists
export const PLAYER_MENU = 0;
export const PLAYER_MENU_CRAFTING = 36;
export const PLAYER_MENU_EXTRA = 46;
// one slot of an opened menu as the client draws it. x and y in gui pixels from the screen's top left, output slots
// can only be taken from, icon is a texture drawn while it's empty
@@ -134,6 +137,8 @@ export type ServerMessage =
blocks: string[];
spawn: { x: number; y: number; z: number; yaw: number; pitch: number };
selected_slot: number;
// the slots mods added to menu 0, from PLAYER_MENU_EXTRA on, see ctx.menus.extend_player_menu
player_menu: MenuSlotInfo[];
// world time in ticks, see common/time.ts
time: number;
}