Skip to content

Commit

Permalink
Biomemap: Avoid empty biomemap entry to fix failing biome dust (#7393)
Browse files Browse the repository at this point in the history
'generateBiomes()' constructs the biomemap as it generates biomes.
The biome calculated at first stone surface encountered is added to
the biomemap.
Previously, if no stone surface was encountered in a mapchunk column
the biomemap was left empty for that (x, z) position, causing biome
dust and water surface decoration placement to fail.

If at the base of a mapchunk column the biomemap is empty, add the
currently active biome to the biomemap, or if biome is NULL calculate
it for this position and add it to the biomemap.
  • Loading branch information
paramat committed Jun 2, 2018
1 parent 162ffd7 commit 99143f4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/mapgen/mapgen.cpp
Expand Up @@ -692,6 +692,7 @@ void MapgenBasic::generateBiomes()
// (Re)calculate biome
biome = biomegen->getBiomeAtIndex(index, v3s16(x, y, z));

// Add biome to biomemap at first stone surface detected
if (biomemap[index] == BIOME_NONE && is_stone_surface)
biomemap[index] = biome->index;

Expand Down Expand Up @@ -761,6 +762,19 @@ void MapgenBasic::generateBiomes()

VoxelArea::add_y(em, vi, -1);
}
// If no stone surface was detected in this mapchunk column the biomemap
// will be empty for this (x, z) position. Add the currently active
// biome to the biomemap, or if biome is NULL calculate it for this
// position.
if (biomemap[index] == BIOME_NONE) {
if (biome) {
biomemap[index] = biome->index;
} else {
biome =
biomegen->getBiomeAtIndex(index, v3s16(x, node_min.Y, z));
biomemap[index] = biome->index;
}
}
}
}

Expand Down

0 comments on commit 99143f4

Please sign in to comment.