This commit is contained in:
2026-10-22 19:55:59 -03:00
parent 1b30d71a47
commit 4cd29a17b3
37 changed files with 427 additions and 155 deletions
+14 -2
View File
@@ -10,7 +10,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 = 23;
export const PROTOCOL_VERSION = 24;
export interface PlayerInfo {
id: string;
@@ -123,6 +123,17 @@ export type ClientMessage =
// right click on a block: interact with it, or place the held block against `face`. hit is where on the block it
// clicked, 0 to 1 on each axis, like minecraft's click location. seq is like break_block's
| { type: "use_block"; x: number; y: number; z: number; face: Faces; hit?: [number, number, number]; seq?: number }
// the mouse wheel turned while looking at a scrollable block, see BlockRegistry.scrollable. amount is how many
// notches, up above 0. face and hit are like use_block's
| {
type: "scroll_block";
x: number;
y: number;
z: number;
face: Faces;
hit: [number, number, number];
amount: number;
}
| { type: "select_slot"; slot: number }
// a slot of the open menu, or of menu 0 when none is. shift moves the stack to the other part of the menu instead,
// like minecraft's quick move. clicks for a menu that isn't open any more are ignored
@@ -224,7 +235,8 @@ export type ServerMessage =
// fields of a block's client data, see BlockRef.set_client_data. to the players who have the chunk: every field
// right after it, then each field when it changes. null when a field is gone, and every field when the block is
| { type: "block_data"; x: number; y: number; z: number; data: Record<string, unknown> }
| { type: "chat"; from?: string; text: string }
// overlay shows it above the hotbar for a moment instead of in chat, like how long a pulse repeater waits
| { type: "chat"; from?: string; text: string; overlay?: boolean }
// the player is here now. with motion, they're moving that fast (blocks per second) too: the server is moving them,
// like when knocked back, and the client keeps going that way until the next one. id counts up, see move
| { type: "teleport"; id: number; x: number; y: number; z: number; motion?: [number, number, number] }