diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2018-07-24 20:31:53 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2018-07-24 20:31:53 +0200 |
commit | b6f14f0c72ecbc2bc255861bbb3982352177eccb (patch) | |
tree | 341195383a07fdd194944f4eedd34965928ab6a7 /src/World/Section.hpp | |
parent | 210f651807847c290ab7ba14c64f9eff1c47284e (diff) | |
download | MinedMap-master.tar MinedMap-master.zip |
Diffstat (limited to 'src/World/Section.hpp')
-rw-r--r-- | src/World/Section.hpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/World/Section.hpp b/src/World/Section.hpp index a4686e3..3444bce 100644 --- a/src/World/Section.hpp +++ b/src/World/Section.hpp @@ -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> §ion, + 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; +}; + } } |