Sounds on shared and server

This commit is contained in:
2026-11-22 07:44:13 -03:00
parent 47934b272c
commit 8e587f6446
16 changed files with 386 additions and 30 deletions
+4
View File
@@ -392,6 +392,8 @@ export function client_of(game: GameServer, area: Area) {
const rules = new BlockRules((_mod, _what, fn) => fn(), (x, y, z) => at(x, y, z)?.[0]);
const recipes = new RecipeBook();
// the sounds its rules played, as the client would play them
const sounds: { sound: string; x: number; y: number; z: number }[] = [];
const world: SharedWorld = {
get_block: (x, y, z) => at(x, y, z)?.[0],
get_state(x, y, z, name) {
@@ -426,9 +428,11 @@ export function client_of(game: GameServer, area: Area) {
// its recipes aren't looked at here
recipes: () => recipes,
running: () => true,
play_sound: (sound, x, y, z) => sounds.push({ sound, x, y, z }),
}));
return {
sounds,
// what game_mode does when this client places held against face of x y z, at hit
place(id: string, x: number, y: number, z: number, yaw: number, face: Face, hit: [number, number, number]) {
const value = rules.placement_value(info(id)!, yaw, 0, { x, y, z, face, hit, sneaking: false, item: id });