diff options
Diffstat (limited to 'src/World/Chunk.cpp')
-rw-r--r-- | src/World/Chunk.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/World/Chunk.cpp b/src/World/Chunk.cpp index 5a6f95b..3a1e9a2 100644 --- a/src/World/Chunk.cpp +++ b/src/World/Chunk.cpp @@ -105,6 +105,13 @@ void Chunk::analyzeChunk() { sections = assertValue(level->get<NBT::ListTag<NBT::CompoundTag>>("Sections")); maxY = (assertValue(sections->back()->get<NBT::ByteTag>("Y"))->getValue() + 1) * SIZE; + + std::shared_ptr<const NBT::ByteArrayTag> biomeTag = assertValue(level->get<NBT::ByteArrayTag>("Biomes")); + if (biomeTag->getLength() != SIZE*SIZE) + throw std::invalid_argument("corrupt biome data"); + + biomes = biomeTag->getValue(); + blockIDs.reset(new uint8_t[maxY * SIZE * SIZE]); blockData.reset(new uint8_t[maxY * SIZE * SIZE / 2]); blockSkyLight.reset(new uint8_t[maxY * SIZE * SIZE / 2]); @@ -170,6 +177,8 @@ Chunk::Blocks Chunk::getTopLayer() const { b.height = h; + b.biome = getBiomeAt(x, z); + done++; } } |