diff --git a/src/pc/common/CommonChunkColumn.js b/src/pc/common/CommonChunkColumn.js index dd4c17a..fe852eb 100644 --- a/src/pc/common/CommonChunkColumn.js +++ b/src/pc/common/CommonChunkColumn.js @@ -5,6 +5,7 @@ class CommonChunkColumn { this.registry = registry // Just a collection of deserialized NBTs this.blockEntities = {} + this.entities = {} this.minY = 0 } @@ -66,6 +67,26 @@ class CommonChunkColumn { this.setBlockEntity({ x: entity.x.value >> 4, y: entity.y.value, z: entity.z.value >> 4 }, entity) } } + + // Entities + + getEntity (id) { + return this.entities[id] + } + + setEntity (id, entity) { + this.entities[id] = entity + } + + removeEntity (id) { + delete this.entities[id] + } + + loadEntities (entities) { + for (const id in entities) { + this.addEntity(id, entities[id]) + } + } } module.exports = CommonChunkColumn