mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-03-05 17:44:52 +01:00
Section: allow empty sections
This commit is contained in:
parent
212a8dcaea
commit
3c92f58110
2 changed files with 13 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2015-2018, Matthias Schiffer <mschiffer@universe-factory.net>
|
Copyright (c) 2015-2019, Matthias Schiffer <mschiffer@universe-factory.net>
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -40,6 +40,9 @@ Section::Section(const std::shared_ptr<const NBT::CompoundTag> §ion) {
|
||||||
blockLight = section->get<NBT::ByteArrayTag>("BlockLight");
|
blockLight = section->get<NBT::ByteArrayTag>("BlockLight");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Resource::BlockType * Section::getBlockStateAt(size_t, size_t, size_t) const {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
std::unique_ptr<Section> Section::makeSection(const std::shared_ptr<const NBT::CompoundTag> §ion) {
|
std::unique_ptr<Section> Section::makeSection(const std::shared_ptr<const NBT::CompoundTag> §ion) {
|
||||||
std::shared_ptr<const NBT::LongArrayTag> blockStates = section->get<NBT::LongArrayTag>("BlockStates");
|
std::shared_ptr<const NBT::LongArrayTag> blockStates = section->get<NBT::LongArrayTag>("BlockStates");
|
||||||
|
@ -49,10 +52,14 @@ std::unique_ptr<Section> Section::makeSection(const std::shared_ptr<const NBT::C
|
||||||
return std::unique_ptr<Section>(new PaletteSection(section, std::move(blockStates), palette));
|
return std::unique_ptr<Section>(new PaletteSection(section, std::move(blockStates), palette));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<const NBT::ByteArrayTag> blocks = assertValue(section->get<NBT::ByteArrayTag>("Blocks"));
|
std::shared_ptr<const NBT::ByteArrayTag> blocks = section->get<NBT::ByteArrayTag>("Blocks");
|
||||||
std::shared_ptr<const NBT::ByteArrayTag> data = assertValue(section->get<NBT::ByteArrayTag>("Data"));
|
if (blocks) {
|
||||||
|
std::shared_ptr<const NBT::ByteArrayTag> data = assertValue(section->get<NBT::ByteArrayTag>("Data"));
|
||||||
|
|
||||||
return std::unique_ptr<Section>(new LegacySection(section, std::move(blocks), std::move(data)));
|
return std::unique_ptr<Section>(new LegacySection(section, std::move(blocks), std::move(data)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::unique_ptr<Section>(new Section(section));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2015-2018, Matthias Schiffer <mschiffer@universe-factory.net>
|
Copyright (c) 2015-2019, Matthias Schiffer <mschiffer@universe-factory.net>
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -72,7 +72,7 @@ public:
|
||||||
|
|
||||||
size_t getY() const { return Y; };
|
size_t getY() const { return Y; };
|
||||||
|
|
||||||
virtual const Resource::BlockType * getBlockStateAt(size_t x, size_t y, size_t z) const = 0;
|
virtual const Resource::BlockType * getBlockStateAt(size_t x, size_t y, size_t z) const;
|
||||||
|
|
||||||
uint8_t getBlockLightAt(size_t x, size_t y, size_t z) const {
|
uint8_t getBlockLightAt(size_t x, size_t y, size_t z) const {
|
||||||
if (!blockLight)
|
if (!blockLight)
|
||||||
|
|
Loading…
Add table
Reference in a new issue