diff options
Diffstat (limited to 'src/Blocks')
-rw-r--r-- | src/Blocks/BlockDirt.h | 15 | ||||
-rw-r--r-- | src/Blocks/BlockLeaves.h | 8 | ||||
-rw-r--r-- | src/Blocks/ChunkInterface.cpp | 7 | ||||
-rw-r--r-- | src/Blocks/ChunkInterface.h | 2 |
4 files changed, 17 insertions, 15 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)) { diff --git a/src/Blocks/BlockLeaves.h b/src/Blocks/BlockLeaves.h index 8807a40ef..653fd19bb 100644 --- a/src/Blocks/BlockLeaves.h +++ b/src/Blocks/BlockLeaves.h @@ -79,7 +79,7 @@ public: NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); if ((Meta & 0x08) != 0) { - a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta & 0x7); + a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta & 0x7, false, false); } } @@ -116,8 +116,10 @@ public: if (HasNearLog(Area, BlockX, a_RelY, BlockZ)) { - // Wood found, the leaves stay; mark them as checked: - a_Chunk.SetMeta(a_RelX, a_RelY, a_RelZ, Meta | 0x8); + // Wood found, the leaves stay; mark them as checked. + // There is no point in saving this to disk or informing the client + // So we use SetMetaQuiet + a_Chunk.SetMeta(a_RelX, a_RelY, a_RelZ, Meta | 0x8, false, false); return; } diff --git a/src/Blocks/ChunkInterface.cpp b/src/Blocks/ChunkInterface.cpp index 7fa2981e9..1f2a97d08 100644 --- a/src/Blocks/ChunkInterface.cpp +++ b/src/Blocks/ChunkInterface.cpp @@ -61,17 +61,14 @@ void cChunkInterface::SetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTY - -void cChunkInterface::SetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_MetaData) +void cChunkInterface::SetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_MetaData, bool a_ShouldMarkDirty, bool a_ShouldInformClient) { - m_ChunkMap->SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, a_MetaData); + m_ChunkMap->SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, a_MetaData, a_ShouldMarkDirty, a_ShouldInformClient); } - - /** Sets the block at the specified coords to the specified value. The replacement doesn't trigger block updates. The replaced blocks aren't checked for block entities (block entity is leaked if it exists at this block) diff --git a/src/Blocks/ChunkInterface.h b/src/Blocks/ChunkInterface.h index 33413ca1a..6de6478f1 100644 --- a/src/Blocks/ChunkInterface.h +++ b/src/Blocks/ChunkInterface.h @@ -27,7 +27,7 @@ public: */ void SetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); - void SetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_MetaData); + void SetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_MetaData, bool a_ShouldMarkDirty = true, bool a_ShouldInformClient = true); /** Sets the block at the specified coords to the specified value. The replacement doesn't trigger block updates. |