World: Section: implement new section-based biome data format

This commit is contained in:
Matthias Schiffer 2021-12-11 19:34:38 +01:00
parent 76e5d322b1
commit baa20494bf
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
4 changed files with 113 additions and 8 deletions

View file

@ -79,6 +79,14 @@ uint8_t Chunk::getBiome(block_idx_t x, y_idx_t y, block_idx_t z) const {
return biomeInts->getValue(z*SIZE + x);
case BYTE_ARRAY:
return biomeBytes->getValue(z*SIZE + x);
case SECTION: {
section_idx_t Y = (y >> HSHIFT) - sectionOffset;
if (Y < 0 || size_t(Y) >= sections.size() || !sections[Y])
break;
return sections[Y]->getBiomeAt(x, y & HMASK, z);
}
default:
break;
}