summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Generating/FinishGen.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp
index e9bf69f55..ef4af91c5 100644
--- a/src/Generating/FinishGen.cpp
+++ b/src/Generating/FinishGen.cpp
@@ -542,6 +542,32 @@ void cFinishGenTallGrass::GenFinish(cChunkDesc & a_ChunkDesc)
continue;
}
+ // Walk below trees:
+ auto BlockBelow = a_ChunkDesc.GetBlockType(x, y - 1, z);
+ bool failed = false; // marker if the search for a valid position was successful
+
+ while (
+ (BlockBelow == E_BLOCK_LEAVES) ||
+ (BlockBelow == E_BLOCK_NEW_LEAVES) ||
+ (BlockBelow == E_BLOCK_LOG) ||
+ (BlockBelow == E_BLOCK_NEW_LOG) ||
+ (BlockBelow == E_BLOCK_AIR)
+ )
+ {
+ y--;
+ if (!cChunkDef::IsValidHeight(y - 1))
+ {
+ failed = true;
+ break;
+ }
+ BlockBelow = a_ChunkDesc.GetBlockType(x, y - 1, z);
+ }
+
+ if (failed)
+ {
+ continue;
+ }
+
// Check if long grass can be placed:
if (
(a_ChunkDesc.GetBlockType(x, y, z) != E_BLOCK_AIR) ||