From 373d9f92a4000d3243fc94d8b5cfb1b64961525d Mon Sep 17 00:00:00 2001 From: LogicParrot Date: Wed, 6 Apr 2016 16:16:16 +0300 Subject: Updated cChunk::SetMeta, fixed grass growth, reduced markDirty/setMeta usage --- src/Blocks/BlockDirt.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/Blocks/BlockDirt.h') 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)) { -- cgit v1.2.3