summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockGrass.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2020-04-21 22:19:22 +0200
committerGitHub <noreply@github.com>2020-04-21 22:19:22 +0200
commit487f9a2aa9b5497495cef1ac3b9c7a603e69f862 (patch)
tree054a846942f414060e29c72f4a717c8a89e70893 /src/Blocks/BlockGrass.h
parentDelet SpawnObject params (diff)
downloadcuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar
cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar.gz
cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar.bz2
cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar.lz
cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar.xz
cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar.zst
cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.zip
Diffstat (limited to 'src/Blocks/BlockGrass.h')
-rw-r--r--src/Blocks/BlockGrass.h25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/Blocks/BlockGrass.h b/src/Blocks/BlockGrass.h
index 374fcceed..51a321b35 100644
--- a/src/Blocks/BlockGrass.h
+++ b/src/Blocks/BlockGrass.h
@@ -90,30 +90,31 @@ public:
// Y Coord out of range
continue;
}
- auto chunk = a_Chunk.GetRelNeighborChunkAdjustCoords(Pos);
- if (chunk == nullptr)
+ auto Chunk = a_Chunk.GetRelNeighborChunkAdjustCoords(Pos);
+ if (Chunk == nullptr)
{
// Unloaded chunk
continue;
}
- chunk->GetBlockTypeMeta(Pos, DestBlock, DestMeta);
+ Chunk->GetBlockTypeMeta(Pos, DestBlock, DestMeta);
if ((DestBlock != E_BLOCK_DIRT) || (DestMeta != E_META_DIRT_NORMAL))
{
// Not a regular dirt block
continue;
}
- BLOCKTYPE Above = chunk->GetBlock(AbovePos);
- NIBBLETYPE light = std::max(chunk->GetBlockLight(AbovePos), chunk->GetTimeAlteredLight(chunk->GetSkyLight(AbovePos)));
- if ((light > 4) &&
- cBlockInfo::IsTransparent(Above) &&
- (!IsBlockLava(Above)) &&
- (!IsBlockWaterOrIce(Above))
+ auto AboveDestPos = Pos.addedY(1);
+ auto AboveBlockType = Chunk->GetBlock(AboveDestPos);
+ auto Light = std::max(Chunk->GetBlockLight(AboveDestPos), Chunk->GetTimeAlteredLight(Chunk->GetSkyLight(AboveDestPos)));
+ if ((Light > 4) &&
+ cBlockInfo::IsTransparent(AboveBlockType) &&
+ (!IsBlockLava(AboveBlockType)) &&
+ (!IsBlockWaterOrIce(AboveBlockType))
)
{
- auto absPos = chunk->RelativeToAbsolute(Pos);
- if (!cRoot::Get()->GetPluginManager()->CallHookBlockSpread(*chunk->GetWorld(), absPos.x, absPos.y, absPos.z, ssGrassSpread))
+ auto AbsPos = Chunk->RelativeToAbsolute(Pos);
+ if (!cRoot::Get()->GetPluginManager()->CallHookBlockSpread(*Chunk->GetWorld(), AbsPos.x, AbsPos.y, AbsPos.z, ssGrassSpread))
{
- chunk->FastSetBlock(Pos, E_BLOCK_GRASS, 0);
+ Chunk->FastSetBlock(Pos, E_BLOCK_GRASS, 0);
}
}
} // for i - repeat twice