int maxY = facet.getWorldRegion().maxY();
for (int z = facet.getRelativeRegion().minZ(); z <= facet.getRelativeRegion().maxZ(); ++z) {
for (int x = facet.getRelativeRegion().minX(); x <= facet.getRelativeRegion().maxX(); ++x) {
int height = TeraMath.floorToInt(surface.get(x, z));
if (height >= minY && height < maxY) {
CoreBiome biome = biomeFacet.get(x, z);
height = height - minY + facet.getRelativeRegion().minY();
if ((biome == CoreBiome.FOREST || biome == CoreBiome.PLAINS) && density.get(x, height, z) > 0
&& density.get(x, height + 1, z) <= 0 && noiseTable.noise(x, z) < configuration.density) {
facet.set(x, height + 1, z, true);