Cache ticking blocks
This commit is contained in:
@@ -547,8 +547,10 @@ export class ModRuntime {
|
||||
return game.world.get_tile(x, y, z)?.mod_data;
|
||||
},
|
||||
set data(value) {
|
||||
game.get_or_create_tile(x, y, z).mod_data = value;
|
||||
game.world.dirty = true;
|
||||
game.set_tile_data(x, y, z, value);
|
||||
},
|
||||
set_ticking(ticking) {
|
||||
game.set_tile_ticking(x, y, z, ticking);
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -687,6 +689,7 @@ export class ModRuntime {
|
||||
},
|
||||
is_face_sturdy: (x, y, z, face) => covers_face(game().world.collision_shape(x, y, z), face),
|
||||
get_block_data: (x, y, z) => game().world.get_tile(x, y, z)?.mod_data as never,
|
||||
set_block_ticking: (x, y, z, ticking) => game().set_tile_ticking(x, y, z, ticking),
|
||||
set_block_item: (x, y, z, item) => {
|
||||
if (game().world.get_block_id(x, y, z) === AIR_ID) return;
|
||||
if (!item || item.count <= 0) {
|
||||
|
||||
Reference in New Issue
Block a user