diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-02-01 15:19:18 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-02-01 15:19:18 +0100 |
commit | 9b1d92387dd83e7340c7ee5f06dbad0a971981b0 (patch) | |
tree | 1978e746b9f8e73c36474797e5a277c9571b12c9 /src/World/Chunk.cpp | |
parent | 143b9f6c78f7cf4c9ed603e57cedb3abf8fb7a3d (diff) | |
download | MinedMap-9b1d92387dd83e7340c7ee5f06dbad0a971981b0.tar MinedMap-9b1d92387dd83e7340c7ee5f06dbad0a971981b0.zip |
Use biome data
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++; } } |