Proper cutting board
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user