summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockDirt.h
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2016-04-16 19:40:35 +0200
committerLogicParrot <LogicParrot@users.noreply.github.com>2016-04-16 19:40:35 +0200
commit032ce6b95ee83be1c853006834c34aef95782e53 (patch)
tree40d0ee18885a94081859f48d9e2ff31d54ee3387 /src/Blocks/BlockDirt.h
parentMerge pull request #3144 from cuberite/issue-template (diff)
parentUpdated cChunk::SetMeta, fixed grass growth, reduced markDirty/setMeta usage (diff)
downloadcuberite-032ce6b95ee83be1c853006834c34aef95782e53.tar
cuberite-032ce6b95ee83be1c853006834c34aef95782e53.tar.gz
cuberite-032ce6b95ee83be1c853006834c34aef95782e53.tar.bz2
cuberite-032ce6b95ee83be1c853006834c34aef95782e53.tar.lz
cuberite-032ce6b95ee83be1c853006834c34aef95782e53.tar.xz
cuberite-032ce6b95ee83be1c853006834c34aef95782e53.tar.zst
cuberite-032ce6b95ee83be1c853006834c34aef95782e53.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))
{