summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockDirt.h
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2016-04-06 15:16:16 +0200
committerLogicParrot <LogicParrot@users.noreply.github.com>2016-04-16 18:04:45 +0200
commit373d9f92a4000d3243fc94d8b5cfb1b64961525d (patch)
tree40d0ee18885a94081859f48d9e2ff31d54ee3387 /src/Blocks/BlockDirt.h
parentMerge pull request #3144 from cuberite/issue-template (diff)
downloadcuberite-373d9f92a4000d3243fc94d8b5cfb1b64961525d.tar
cuberite-373d9f92a4000d3243fc94d8b5cfb1b64961525d.tar.gz
cuberite-373d9f92a4000d3243fc94d8b5cfb1b64961525d.tar.bz2
cuberite-373d9f92a4000d3243fc94d8b5cfb1b64961525d.tar.lz
cuberite-373d9f92a4000d3243fc94d8b5cfb1b64961525d.tar.xz
cuberite-373d9f92a4000d3243fc94d8b5cfb1b64961525d.tar.zst
cuberite-373d9f92a4000d3243fc94d8b5cfb1b64961525d.zip
Diffstat (limited to '')
-rw-r--r--src/Blocks/BlockDirt.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/Blocks/BlockDirt.h b/src/Blocks/BlockDirt.h
index 336fa8c51..a06d9d030 100644
--- a/src/Blocks/BlockDirt.h
+++ b/src/Blocks/BlockDirt.h
@@ -51,8 +51,8 @@ public:
{
BLOCKTYPE above = a_Chunk.GetBlock(a_RelX, a_RelY + 1, a_RelZ);
- // Grass turns back to dirt when the block above is not transparent
- if (!cBlockInfo::IsTransparent(above))
+ // Grass turns back to dirt when the block above it is not transparent or water
+ if (!cBlockInfo::IsTransparent(above) || IsBlockWater(above))
{
a_Chunk.FastSetBlock(a_RelX, a_RelY, a_RelZ, E_BLOCK_DIRT, E_META_DIRT_NORMAL);
return;
@@ -97,10 +97,13 @@ public:
// Not a regular dirt block
continue;
}
- BLOCKTYPE above = a_Chunk.GetBlock(BlockX, BlockY + 1, BlockZ);
- NIBBLETYPE light = std::max(a_Chunk.GetBlockLight(BlockX, BlockY + 1, BlockZ), a_Chunk.GetTimeAlteredLight(a_Chunk.GetSkyLight(BlockX, BlockY + 1, BlockZ)));
- // Grass does not spread to blocks with a light level less than 5
- if ((light > 4) && cBlockInfo::IsTransparent(above))
+ BLOCKTYPE above = Chunk->GetBlock(BlockX, BlockY + 1, BlockZ);
+ NIBBLETYPE light = std::max(Chunk->GetBlockLight(BlockX, BlockY + 1, BlockZ), Chunk->GetTimeAlteredLight(Chunk->GetSkyLight(BlockX, BlockY + 1, BlockZ)));
+ if ((light > 4) &&
+ cBlockInfo::IsTransparent(above) &&
+ (!IsBlockLava(above)) &&
+ (!IsBlockWaterOrIce(above))
+ )
{
if (!cRoot::Get()->GetPluginManager()->CallHookBlockSpread(*Chunk->GetWorld(), Chunk->GetPosX() * cChunkDef::Width + BlockX, BlockY, Chunk->GetPosZ() * cChunkDef::Width + BlockZ, ssGrassSpread))
{