From 9b1d92387dd83e7340c7ee5f06dbad0a971981b0 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 1 Feb 2015 15:19:18 +0100 Subject: Use biome data --- src/World/Chunk.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/World/Chunk.cpp') 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>("Sections")); maxY = (assertValue(sections->back()->get("Y"))->getValue() + 1) * SIZE; + + std::shared_ptr biomeTag = assertValue(level->get("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++; } } -- cgit v1.2.3