Cache ticking blocks

This commit is contained in:
2026-10-12 19:37:04 -03:00
parent c5ffc23bcd
commit 02cbeda0a0
9 changed files with 195 additions and 56 deletions
+5
View File
@@ -44,6 +44,9 @@ export interface BlockRef {
// tile data, any json value. saved with the world, never sent to clients
// deno-lint-ignore no-explicit-any
data: any;
// turns on_tick and on_second off for this block, or back on, like a machine with nothing to do. it stays off until
// it's turned on again, saved with the world, and goes with the block
set_ticking(ticking: boolean): void;
}
// P is the component's params from the block json
@@ -215,6 +218,8 @@ export interface ServerWorld {
// shape covers the whole face. false for air, plants, water and the sides of a slab
is_face_sturdy(x: number, y: number, z: number, face: Face): boolean;
get_block_data<T>(x: number, y: number, z: number): T | undefined;
// BlockRef.set_ticking for a block, for waking one from somewhere else, like a machine getting something to work on
set_block_ticking(x: number, y: number, z: number, ticking: boolean): void;
// the item a block with item_display shows on top of it, like a block entity renderer: saved with the block's data
// and synced to players. undefined shows nothing. it goes away with the block, without dropping
set_block_item(x: number, y: number, z: number, item: ItemStack | undefined): void;