mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-04-20 03:25:09 +02:00
Ignore chunks without sections
This commit is contained in:
parent
02010d1a0d
commit
e6348ac5a2
1 changed files with 11 additions and 9 deletions
|
@ -43,15 +43,6 @@ Chunk::Chunk(const ChunkData *data) {
|
||||||
if (!sectionsTag)
|
if (!sectionsTag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
biomeBytes = level->get<NBT::ByteArrayTag>("Biomes");
|
|
||||||
biomeInts = level->get<NBT::IntArrayTag>("Biomes");
|
|
||||||
assertValue(biomeBytes || biomeInts);
|
|
||||||
|
|
||||||
if (biomeBytes && biomeBytes->getLength() != SIZE*SIZE)
|
|
||||||
throw std::invalid_argument("corrupt biome data");
|
|
||||||
else if (biomeInts && biomeInts->getLength() != SIZE*SIZE)
|
|
||||||
throw std::invalid_argument("corrupt biome data");
|
|
||||||
|
|
||||||
for (auto &sTag : *sectionsTag) {
|
for (auto &sTag : *sectionsTag) {
|
||||||
auto s = std::dynamic_pointer_cast<const NBT::CompoundTag>(sTag);
|
auto s = std::dynamic_pointer_cast<const NBT::CompoundTag>(sTag);
|
||||||
std::unique_ptr<Section> section = Section::makeSection(s);
|
std::unique_ptr<Section> section = Section::makeSection(s);
|
||||||
|
@ -61,6 +52,17 @@ Chunk::Chunk(const ChunkData *data) {
|
||||||
sections.push_back(std::move(section));
|
sections.push_back(std::move(section));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!sections.empty()) {
|
||||||
|
biomeBytes = level->get<NBT::ByteArrayTag>("Biomes");
|
||||||
|
biomeInts = level->get<NBT::IntArrayTag>("Biomes");
|
||||||
|
assertValue(biomeBytes || biomeInts);
|
||||||
|
|
||||||
|
if (biomeBytes && biomeBytes->getLength() != SIZE*SIZE)
|
||||||
|
throw std::invalid_argument("corrupt biome data");
|
||||||
|
else if (biomeInts && biomeInts->getLength() != SIZE*SIZE)
|
||||||
|
throw std::invalid_argument("corrupt biome data");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Chunk::getBlock(Block *block, const Section *section, size_t x, size_t y, size_t z, uint8_t prev_light) const {
|
bool Chunk::getBlock(Block *block, const Section *section, size_t x, size_t y, size_t z, uint8_t prev_light) const {
|
||||||
|
|
Loading…
Add table
Reference in a new issue