Blocks interacting on the world api

This commit is contained in:
2026-10-15 12:49:44 -03:00
parent 7faa070d83
commit b43e8fe8b8
15 changed files with 493 additions and 28 deletions
+6 -1
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 = 22;
export const PROTOCOL_VERSION = 23;
export interface PlayerInfo {
id: string;
@@ -228,6 +228,11 @@ export type ServerMessage =
// 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] }
// something pushed the player, like a fan: add this to how fast they're moving, in blocks per second
| { type: "push"; motion: [number, number, number] }
// cracks on a block a machine is breaking, from 0 to BREAK_STAGES, to the players who have its chunk. none without
// a stage, and when the block changes
| { type: "break_progress"; x: number; y: number; z: number; stage?: number }
| { type: "container"; container: ContainerKey; items: (ItemData | null)[] }
| { type: "cursor"; item: ItemData | null }
// a menu opened, replacing any other. id counts 1 to 100 and around, type is the menu type whose screen draws it.