working blockstates

This commit is contained in:
2026-07-03 22:32:48 -04:00
parent 2fa76da8bc
commit a702916de3
7 changed files with 380 additions and 178 deletions

23
world.js Normal file
View File

@@ -0,0 +1,23 @@
// 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 });
}
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}`);
}
}