summaryrefslogtreecommitdiffstats
path: root/src/Generating/FinishGen.cpp
diff options
context:
space:
mode:
author12xx12 <44411062+12xx12@users.noreply.github.com>2021-04-23 21:00:02 +0200
committerGitHub <noreply@github.com>2021-04-23 21:00:02 +0200
commit4a2d0ce9d32eac0df2acb116e6242490b2adf868 (patch)
treeb6556dab344dd3390db6408497af8865abc7ab73 /src/Generating/FinishGen.cpp
parentRepaired Hoppers Treating Chests as two entities (#5202) (diff)
downloadcuberite-4a2d0ce9d32eac0df2acb116e6242490b2adf868.tar
cuberite-4a2d0ce9d32eac0df2acb116e6242490b2adf868.tar.gz
cuberite-4a2d0ce9d32eac0df2acb116e6242490b2adf868.tar.bz2
cuberite-4a2d0ce9d32eac0df2acb116e6242490b2adf868.tar.lz
cuberite-4a2d0ce9d32eac0df2acb116e6242490b2adf868.tar.xz
cuberite-4a2d0ce9d32eac0df2acb116e6242490b2adf868.tar.zst
cuberite-4a2d0ce9d32eac0df2acb116e6242490b2adf868.zip
Diffstat (limited to 'src/Generating/FinishGen.cpp')
-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) ||