Send chunks to players connected to server
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Container, Cursor, ItemData, ItemStack } from "$/common/inventory.ts";
|
||||
import { PlayerInfo, ScreenLayout } from "$/common/protocol.ts";
|
||||
import { type SavedVitals, Vitals } from "./vitals.ts";
|
||||
import { PlayerChunks } from "./player_chunks.ts";
|
||||
|
||||
export const INVENTORY_SIZE = 9 * 4;
|
||||
export const CRAFTING_SIZE = 10;
|
||||
@@ -64,10 +65,13 @@ export class ServerPlayer {
|
||||
|
||||
// last json sent for each synced thing, so only changes get sent
|
||||
sent = new Map<string, string>();
|
||||
// the chunks their client has and still needs
|
||||
chunks: PlayerChunks;
|
||||
|
||||
constructor(conn: number, name: string) {
|
||||
constructor(conn: number, name: string, view_distance: number) {
|
||||
this.conn = conn;
|
||||
this.name = name;
|
||||
this.chunks = new PlayerChunks(view_distance);
|
||||
}
|
||||
|
||||
get held_item(): ItemStack | undefined {
|
||||
|
||||
Reference in New Issue
Block a user