diff --git a/src/World/Chunk.cpp b/src/World/Chunk.cpp index c326669..fc0307e 100644 --- a/src/World/Chunk.cpp +++ b/src/World/Chunk.cpp @@ -19,7 +19,7 @@ namespace World { Chunk::Chunk(const ChunkData *data) { std::shared_ptr level = - assertValue(data->getRoot().get("Level")); + assertValue(data->getRoot()->get("Level")); std::shared_ptr sectionsTag = level->get("Sections"); if (!sectionsTag || sectionsTag->empty()) @@ -37,7 +37,7 @@ Chunk::Chunk(const ChunkData *data) { else throw std::invalid_argument("corrupt biome data"); - auto dataVersionTag = data->getRoot().get("DataVersion"); + auto dataVersionTag = data->getRoot()->get("DataVersion"); uint32_t dataVersion = dataVersionTag ? dataVersionTag->getValue() : 0; for (auto &sTag : *sectionsTag) { diff --git a/src/World/ChunkData.hpp b/src/World/ChunkData.hpp index cb27f7b..62a69c1 100644 --- a/src/World/ChunkData.hpp +++ b/src/World/ChunkData.hpp @@ -32,8 +32,8 @@ private: public: ChunkData(Buffer buffer); - const NBT::CompoundTag & getRoot() const { - return *root; + const std::shared_ptr & getRoot() const { + return root; } }; diff --git a/src/regiondump.cpp b/src/regiondump.cpp index 76df061..a091536 100644 --- a/src/regiondump.cpp +++ b/src/regiondump.cpp @@ -25,7 +25,7 @@ int main(int argc, char *argv[]) { World::Region::visitChunks(argv[1], [&] (chunk_idx_t X, chunk_idx_t Z, const World::ChunkData *chunk) { std::cout << "Chunk(" << X << ", " << Z << "): " - << chunk->getRoot() << std::endl; + << *chunk->getRoot() << std::endl; }); return 0;