mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-07-05 15:19:07 +02:00
NBT: rework type system
This commit is contained in:
parent
315bb38444
commit
f1f783877f
17 changed files with 162 additions and 228 deletions
|
@ -44,8 +44,9 @@ Chunk::Chunk(const ChunkData *data) {
|
|||
std::shared_ptr<const NBT::ByteTag> lightPopulatedTag = level->get<NBT::ByteTag>("LightPopulated");
|
||||
bool lightPopulated = lightPopulatedTag && lightPopulatedTag->getValue();
|
||||
|
||||
sections = assertValue(level->get<NBT::ListTag<NBT::CompoundTag>>("Sections"));
|
||||
maxY = (assertValue(sections->back()->get<NBT::ByteTag>("Y"))->getValue() + 1) * SIZE;
|
||||
sections = assertValue(level->get<NBT::ListTag>("Sections"));
|
||||
const NBT::CompoundTag *lastSection = assertValue(dynamic_cast<const NBT::CompoundTag *>(sections->back().get()));
|
||||
maxY = (assertValue(lastSection->get<NBT::ByteTag>("Y"))->getValue() + 1) * SIZE;
|
||||
|
||||
|
||||
std::shared_ptr<const NBT::ByteArrayTag> biomeTag = assertValue(level->get<NBT::ByteArrayTag>("Biomes"));
|
||||
|
@ -65,7 +66,8 @@ Chunk::Chunk(const ChunkData *data) {
|
|||
std::memset(blockBlockLight.get(), 0, maxY * SIZE * SIZE / 2);
|
||||
|
||||
|
||||
for (auto §ion : *sections) {
|
||||
for (auto §ionTag : *sections) {
|
||||
const NBT::CompoundTag *section = assertValue(dynamic_cast<const NBT::CompoundTag *>(sectionTag.get()));
|
||||
std::shared_ptr<const NBT::ByteArrayTag> blocks = assertValue(section->get<NBT::ByteArrayTag>("Blocks"));
|
||||
std::shared_ptr<const NBT::ByteArrayTag> data = assertValue(section->get<NBT::ByteArrayTag>("Data"));
|
||||
size_t Y = assertValue(section->get<NBT::ByteTag>("Y"))->getValue();
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
|
||||
private:
|
||||
std::shared_ptr<const NBT::CompoundTag> level;
|
||||
std::shared_ptr<const NBT::ListTag<NBT::CompoundTag>> sections;
|
||||
std::shared_ptr<const NBT::ListTag> sections;
|
||||
|
||||
|
||||
unsigned maxY;
|
||||
|
@ -107,7 +107,7 @@ public:
|
|||
return *level;
|
||||
}
|
||||
|
||||
const NBT::ListTag<NBT::CompoundTag> & getSections() const {
|
||||
const NBT::ListTag & getSections() const {
|
||||
return *sections;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue