This commit is contained in:
2026-10-02 11:07:09 -03:00
parent d5015edfa1
commit 9ca717d2d0
18 changed files with 449 additions and 38 deletions
+25 -4
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 = 17;
export const PROTOCOL_VERSION = 18;
export interface PlayerInfo {
id: string;
@@ -23,6 +23,8 @@ export interface PlayerInfo {
slim?: boolean;
// what they're wearing that shows, see player_worn
worn?: ItemData[];
// lying flat in the short box, see PLAYER_SWIM_HEIGHT
swimming?: boolean;
}
// an entity that isn't a player, as the server first sends it. players have their own messages. items on the
@@ -87,8 +89,18 @@ export type ClientMessage =
| { type: "view_distance"; distance: number }
// answers chunk_batch_finished once the batch is loaded, with how many chunks a tick the client can take
| { type: "chunk_batch_received"; chunks_per_tick: number }
// teleport is the id of the last teleport the client heard of. moves from before the latest one are ignored
| { type: "move"; x: number; y: number; z: number; yaw: number; pitch: number; teleport?: number }
// teleport is the id of the last teleport the client heard of. moves from before the latest one are ignored.
// swimming is whether they're swimming, sent right away when it changes
| {
type: "move";
x: number;
y: number;
z: number;
yaw: number;
pitch: number;
teleport?: number;
swimming?: boolean;
}
| { type: "break_block"; x: number; y: number; z: number }
// the player started hitting a block, for on_click
| { type: "hit_block"; x: number; y: number; z: number }
@@ -155,7 +167,16 @@ export type ServerMessage =
| { type: "chunk_batch_finished"; size: number }
| { type: "player_join"; player: PlayerInfo }
| { type: "player_leave"; id: string }
| { type: "player_move"; id: string; x: number; y: number; z: number; yaw: number; pitch: number }
| {
type: "player_move";
id: string;
x: number;
y: number;
z: number;
yaw: number;
pitch: number;
swimming?: boolean;
}
// a player changed their skin, including the one receiving it. without skin it's back to the default
| { type: "player_skin"; id: string; skin?: string; slim?: boolean }
// what a player wears that shows changed, to everyone including them: the items whose json has worn, see