diff --git a/src/World/Section.cpp b/src/World/Section.cpp index ffa2789..ba7b0c9 100644 --- a/src/World/Section.cpp +++ b/src/World/Section.cpp @@ -8,6 +8,7 @@ #include "Section.hpp" #include "../Resource/Biome.hpp" #include "../NBT/ByteTag.hpp" +#include "../NBT/IntTag.hpp" #include "../NBT/StringTag.hpp" #include @@ -17,7 +18,16 @@ namespace MinedMap { namespace World { Section::Section(const std::shared_ptr §ion) { - Y = int8_t(assertValue(section->get("Y"))->getValue()); + const std::shared_ptr YByteTag = section->get("Y"); + if (YByteTag) { + Y = int8_t(YByteTag->getValue()); + } else { + const std::shared_ptr YIntTag = assertValue(section->get("Y")); + int32_t value = YIntTag->getValue(); + if (int8_t(value) != value) + throw std::invalid_argument("unsupported section Y coordinate"); + Y = value; + } blockLight = section->get("BlockLight"); }