Curios slots rendering !

This commit is contained in:
2026-10-01 17:57:22 -03:00
parent ea9f3f61bb
commit f2c3cb8135
39 changed files with 1032 additions and 226 deletions
+15
View File
@@ -347,6 +347,7 @@ export class GameServer {
this.entities.sync();
for (const player of this.#players.values()) {
this.#sync_worn(player);
this.#sync(player);
}
this.#send_chunks();
@@ -728,6 +729,11 @@ export class GameServer {
time: this.world.time,
});
this.#players.set(conn, player);
// what they wear themselves, the others get it with player_join
player.worn_sent = JSON.stringify(player.worn_list());
if (player.worn_sent !== "[]") {
this.#send(player, { type: "player_worn", id: player.id, worn: player.worn_list() });
}
// the chunks come with the next ticks
this.#update_view(player);
this.#sync(player);
@@ -1555,6 +1561,15 @@ export class GameServer {
}
}
// what a player wears that shows, to everyone when it changed
#sync_worn(player: ServerPlayer) {
const worn = player.worn_list();
const json = JSON.stringify(worn);
if (json === player.worn_sent) return;
player.worn_sent = json;
this.#broadcast({ type: "player_worn", id: player.id, worn });
}
// tell the player what's really at a position, undoing anything their client guessed
#correct(player: ServerPlayer, x: number, y: number, z: number) {
if (y < 0 || y >= CHUNK_HEIGHT || !player.chunks.has_block(x, z)) {