Neighbor Updates as a Queue

This commit is contained in:
2026-10-20 13:40:44 -03:00
parent 0af35d1e17
commit 77cd327f94
9 changed files with 348 additions and 138 deletions
+12 -1
View File
@@ -248,7 +248,13 @@ export interface ServerWorld {
// destroyBlockProgress: a drill getting through it. undefined takes them off, and so does the block changing
set_break_progress(x: number, y: number, z: number, progress: number | undefined): void;
get_state(x: number, y: number, z: number, name: string): number | undefined;
set_state(x: number, y: number, z: number, name: string, value: number): boolean;
// update_neighbors false changes the state without telling the blocks around it, for a script that tells them
// itself, like a wire telling each block beside its whole length once. on_state_change still runs
set_state(x: number, y: number, z: number, name: string, value: number, options?: SetStateOptions): boolean;
// tells the block at x y z that the one at from changed, running its rules' and components' on_neighbor_change,
// like neoforge's neighborChanged. for a block whose effect on others changed without it changing, or for blocks
// it reaches that aren't beside it. it hears once the change going on is done, like the blocks beside one do
neighbor_changed(x: number, y: number, z: number, from: Position): void;
// whether the block's side is a full square things can attach to, like minecraft's isFaceSturdy: its collision
// 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;
@@ -301,6 +307,11 @@ export interface ServerWorld {
set_time(time: number): void;
}
export interface SetStateOptions {
// true when not given
update_neighbors?: boolean;
}
// how a machine breaks a block, see ServerWorld.break_block
export interface BreakOptions {
// it drops what it would for the right tool, though nothing holds one, like create's drills and saws