Proper cutting board

This commit is contained in:
2026-09-29 00:04:56 -03:00
parent a51adba46f
commit 445148e812
26 changed files with 549 additions and 16 deletions
+16
View File
@@ -434,6 +434,19 @@ export class ModRuntime {
return true;
},
get_block_data: (x, y, z) => game().world.get_tile(x, y, z)?.mod_data as never,
set_block_item: (x, y, z, item) => {
if (game().world.get_block_id(x, y, z) === AIR_ID) return;
if (!item || item.count <= 0) {
const tile = game().world.get_tile(x, y, z);
if (tile?.item) game().world.set_tile_item(tile, undefined);
return;
}
game().world.set_tile_item(game().get_or_create_tile(x, y, z), new_stack(item).to_data());
},
get_block_item: (x, y, z) => {
const item = game().world.get_tile(x, y, z)?.item;
return item && structuredClone(item);
},
drop_item: (x, y, z, item) => void game().pop_item(x, y, z, new_stack(item)),
spawn_entity: (id, x, y, z) => {
const entity = EverythingRegistry.get("entities", id)
@@ -750,6 +763,9 @@ function player_api(game: GameServer, player: ServerPlayer): Player {
get position() {
return { x: player.x, y: player.y, z: player.z };
},
get yaw() {
return player.yaw;
},
inventory,
get selected_slot() {
return player.selected_slot;