// world.js export class World { constructor() { this.blocks = new Map(); // Keyed by "x,y,z" } setBlock(id, x, y, z, props = {}) { const key = `${x},${y},${z}`; this.blocks.set(key, { id, x, y, z, props }); } removeBlock(x, y, z) { this.blocks.delete(`${x},${y},${z}`); } updateBlock(x, y, z, newProps) { const key = `${x},${y},${z}`; const block = this.blocks.get(key); if (block) { block.props = { ...block.props, ...newProps }; } } getBlock(x, y, z) { return this.blocks.get(`${x},${y},${z}`); } }