Shared state between client and server
This commit is contained in:
@@ -49,12 +49,7 @@ export interface BlockComponent<P = any> {
|
||||
on_second?(block: BlockRef, params: P, dt: number): void;
|
||||
// every morning at 06:00, for every block with data in the world, near a player or not. day is ServerWorld.day
|
||||
on_new_day?(block: BlockRef, params: P, day: number): void;
|
||||
// a block next to it (on any of the 6 sides) was placed, broken or changed its states, like minecraft's
|
||||
// updateShape. neighbor is where, and what's there now
|
||||
on_neighbor_change?(block: BlockRef, params: P, neighbor: Position & { readonly id: Id }): void;
|
||||
// the states it's placed with when a player places it, like minecraft's getStateForPlacement. states it doesn't
|
||||
// return keep their defaults, and a 2 bit "facing" faces the player
|
||||
state_for_placement?(placement: BlockPlacement, params: P): Record<string, number> | void;
|
||||
// placing and neighbor rules are in shared scripts, see BlockRules in bworld/shared
|
||||
}
|
||||
|
||||
// deno-lint-ignore no-explicit-any
|
||||
@@ -149,14 +144,6 @@ export interface BlockPlaceEvent {
|
||||
readonly item: ItemStack | undefined;
|
||||
}
|
||||
|
||||
// a player placing a block at x y z by clicking face of the block next to it, at hit (0 to 1 on each axis of that
|
||||
// block), like minecraft's BlockPlaceContext
|
||||
export interface BlockPlacement extends Position {
|
||||
readonly player: Player;
|
||||
readonly face: Face;
|
||||
readonly hit: readonly [number, number, number];
|
||||
}
|
||||
|
||||
export interface BlockInteractEvent {
|
||||
readonly player: Player;
|
||||
readonly block: BlockRef;
|
||||
|
||||
Reference in New Issue
Block a user