Use biome data

This commit is contained in:
Matthias Schiffer 2015-02-01 15:19:18 +01:00
parent 143b9f6c78
commit 9b1d92387d
5 changed files with 20 additions and 4 deletions

View file

@ -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++;
}
}