Day night cycle

This commit is contained in:
2026-09-26 11:03:07 -03:00
parent 8f32a59bd6
commit 8b549162c4
16 changed files with 244 additions and 6 deletions
+6 -2
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 = 2;
export const PROTOCOL_VERSION = 3;
export interface PlayerInfo {
id: string;
@@ -101,6 +101,8 @@ export type ServerMessage =
changes: BlockChange[];
spawn: { x: number; y: number; z: number; yaw: number; pitch: number };
selected_slot: number;
// world time in ticks, see common/time.ts
time: number;
}
| { type: "player_join"; player: PlayerInfo }
| { type: "player_leave"; id: string }
@@ -120,7 +122,9 @@ export type ServerMessage =
| { type: "cursor"; item: ItemData | null }
| { type: "open_screen"; layout: ScreenLayout; properties: Record<string, number> }
| { type: "screen_properties"; properties: Record<string, number> }
| { type: "close_screen" };
| { type: "close_screen" }
// the world time, every second and when it's changed. clients count ticks in between
| { type: "time"; time: number };
export const MAX_NAME_LENGTH = 16;
export const MAX_CHAT_LENGTH = 256;