mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-07 03:51:50 +00:00
add 'offset', 'bits' properties & fix is_solid_at
This commit is contained in:
parent
29021d1178
commit
7e0b58d96b
3 changed files with 22 additions and 5 deletions
|
|
@ -121,7 +121,18 @@ template<> void ContentUnitLoader<Block>::loadUnit(
|
|||
const auto& stateBased = root["state-based"];
|
||||
if (stateBased.has("variants")) {
|
||||
const auto& variants = stateBased["variants"];
|
||||
|
||||
int offset = 0;
|
||||
int bitsCount = 4;
|
||||
stateBased.at("offset").get(offset);
|
||||
stateBased.at("bits").get(bitsCount);
|
||||
if (offset < 0 || bitsCount <= 0 || offset + bitsCount > 8) {
|
||||
throw std::runtime_error("Invalid state-based bits configuration");
|
||||
}
|
||||
|
||||
def.variants = std::make_unique<Variants>();
|
||||
def.variants->offset = 0;
|
||||
def.variants->mask = 0xF;
|
||||
def.variants->variants.push_back(def.defaults);
|
||||
for (int i = 0; i < variants.size(); i++) {
|
||||
Variant variant = def.defaults;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue