Fixing grass not generating below trees (#5199)
* moves the y-Position below the tree on grass generation
This commit is contained in:
parent
d117a6c5db
commit
4a2d0ce9d3
@ -542,6 +542,32 @@ void cFinishGenTallGrass::GenFinish(cChunkDesc & a_ChunkDesc)
|
|||||||
continue;
|
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:
|
// Check if long grass can be placed:
|
||||||
if (
|
if (
|
||||||
(a_ChunkDesc.GetBlockType(x, y, z) != E_BLOCK_AIR) ||
|
(a_ChunkDesc.GetBlockType(x, y, z) != E_BLOCK_AIR) ||
|
||||||
|
Loading…
Reference in New Issue
Block a user