Add support for Minecraft 1.13 sections

This commit is contained in:
Matthias Schiffer 2018-07-24 20:31:53 +02:00
parent 210f651807
commit b6f14f0c72
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
2 changed files with 80 additions and 0 deletions

View file

@ -29,6 +29,8 @@
#include "../NBT/ByteArrayTag.hpp"
#include "../NBT/CompoundTag.hpp"
#include "../NBT/ListTag.hpp"
#include "../NBT/LongArrayTag.hpp"
#include "../Resource/BlockType.hpp"
#include <cstdint>
@ -106,5 +108,27 @@ public:
virtual const Resource::BlockType * getBlockStateAt(size_t x, size_t y, size_t z) const;
};
class PaletteSection : public Section {
private:
std::shared_ptr<const NBT::LongArrayTag> blockStates;
std::vector<const Resource::BlockType *> palette;
size_t bits;
uint16_t mask;
static size_t mangleByteIndex(size_t index) {
return (index & ~(size_t)7) + 7 - (index & 7);
}
public:
PaletteSection(
const std::shared_ptr<const NBT::CompoundTag> &section,
std::shared_ptr<const NBT::LongArrayTag> &&blockStates0,
const std::shared_ptr<const NBT::ListTag> &paletteData
);
virtual const Resource::BlockType * getBlockStateAt(size_t x, size_t y, size_t z) const;
};
}
}