Add quirk for stone_slab rename

The old stone_slab block from pre-1.14 has been renamed to
smooth_stone_slab, and the name stone_slab was reused for a new block.
Resolve the palette entry depending on the chunk's dataVersion.
This commit is contained in:
Matthias Schiffer 2019-05-25 19:51:28 +02:00
parent 359ace4932
commit ae68c3bab4
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
4 changed files with 24 additions and 9 deletions

View file

@ -25,6 +25,7 @@
#include "Chunk.hpp"
#include "../NBT/IntTag.hpp"
#include "../NBT/ListTag.hpp"
#include "../NBT/StringTag.hpp"
@ -51,9 +52,12 @@ Chunk::Chunk(const ChunkData *data) {
else if (biomeInts && biomeInts->getLength() != SIZE*SIZE)
throw std::invalid_argument("corrupt biome data");
auto dataVersionTag = data->getRoot().get<NBT::IntTag>("DataVersion");
uint32_t dataVersion = dataVersionTag ? dataVersionTag->getValue() : 0;
for (auto &sTag : *sectionsTag) {
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, dataVersion);
size_t Y = section->getY();
sections.resize(Y);
sections.push_back(std::move(section));