mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-07-02 13:59:07 +02:00
Use template argument for list subtype, extract further information from chunks
This commit is contained in:
parent
a6a2a62812
commit
fc1fc8fbbc
9 changed files with 108 additions and 32 deletions
|
@ -95,6 +95,10 @@ Chunk::Chunk(uint8_t *buffer, size_t buflen) {
|
|||
|
||||
if (!(*this) || tag.first != "")
|
||||
throw std::invalid_argument("invalid root tag");
|
||||
|
||||
sections = (*this)->get<const NBT::ListTag<NBT::CompoundTag>>("Level", "Sections");
|
||||
if (!sections)
|
||||
throw std::invalid_argument("no sections found");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include "../UniqueCPtr.hpp"
|
||||
#include "../NBT/CompoundTag.hpp"
|
||||
#include "../NBT/ListTag.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <tuple>
|
||||
|
@ -44,8 +45,14 @@ public:
|
|||
private:
|
||||
static std::pair<UniqueCPtr<uint8_t[]>, size_t> inflateChunk(uint8_t *data, size_t len);
|
||||
|
||||
std::shared_ptr<const NBT::ListTag<NBT::CompoundTag>> sections;
|
||||
|
||||
public:
|
||||
Chunk(uint8_t *buffer, size_t buflen);
|
||||
|
||||
const NBT::ListTag<NBT::CompoundTag> & getSections() const {
|
||||
return *sections;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue