1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-10 19:32:10 +00:00

Mapgen: Fix biome Y calculation regression

BiomeGen::getNextTransitionY(y) did not guarantee the condition (y < biome_y_min)
of the next loop because the function may return the value (biome_y_min - 1).
Hence, the biome was not updated until one Y coordinate after.
This commit is contained in:
SmallJoker 2024-11-28 22:12:24 +01:00 committed by SmallJoker
parent 50928b9759
commit 480eb7d816
5 changed files with 24 additions and 15 deletions

View file

@ -84,7 +84,7 @@ void CavesNoiseIntersection::generateCaves(MMVManip *vm,
u16 depth_riverbed = biome->depth_riverbed;
u16 nplaced = 0;
s16 biome_y_min = m_bmgn->getNextTransitionY(nmax.Y);
s16 biome_y_next = m_bmgn->getNextTransitionY(nmax.Y);
// Don't excavate the overgenerated stone at nmax.Y + 1,
// this creates a 'roof' over the tunnel, preventing light in
@ -94,13 +94,13 @@ void CavesNoiseIntersection::generateCaves(MMVManip *vm,
index3d -= m_ystride,
VoxelArea::add_y(em, vi, -1)) {
// We need this check to make sure that biomes don't generate too far down
if (y < biome_y_min) {
if (y <= biome_y_next) {
biome = m_bmgn->getBiomeAtIndex(index2d, v3s16(x, y, z));
biome_y_min = m_bmgn->getNextTransitionY(y);
biome_y_next = m_bmgn->getNextTransitionY(y);
if (x == nmin.X && z == nmin.Z && false) {
dstream << "cavegen: biome at " << y << " is " << biome->name
<< ", next at " << biome_y_min << std::endl;
<< ", next at " << biome_y_next << std::endl;
}
}