summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Harkness <bearbin@gmail.com>2015-03-05 20:29:57 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2015-03-05 20:30:00 +0100
commit7348bf38534bfdfa0c82a103474c4488bf21fe9e (patch)
tree5276651527ec5600cc6b248f3b908905aa56b29f
parentMerge pull request #1790 from joshi07/master (diff)
downloadcuberite-7348bf38534bfdfa0c82a103474c4488bf21fe9e.tar
cuberite-7348bf38534bfdfa0c82a103474c4488bf21fe9e.tar.gz
cuberite-7348bf38534bfdfa0c82a103474c4488bf21fe9e.tar.bz2
cuberite-7348bf38534bfdfa0c82a103474c4488bf21fe9e.tar.lz
cuberite-7348bf38534bfdfa0c82a103474c4488bf21fe9e.tar.xz
cuberite-7348bf38534bfdfa0c82a103474c4488bf21fe9e.tar.zst
cuberite-7348bf38534bfdfa0c82a103474c4488bf21fe9e.zip
-rw-r--r--src/Blocks/BlockDirt.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/Blocks/BlockDirt.h b/src/Blocks/BlockDirt.h
index aae6719e2..12bca92dd 100644
--- a/src/Blocks/BlockDirt.h
+++ b/src/Blocks/BlockDirt.h
@@ -52,7 +52,19 @@ public:
return;
}
}
-
+
+ // Make sure that there is enough light at the source block to spread
+ if (!a_Chunk.GetWorld()->IsChunkLighted(a_Chunk.GetPosX(), a_Chunk.GetPosZ()))
+ {
+ a_Chunk.GetWorld()->QueueLightChunk(a_Chunk.GetPosX(), a_Chunk.GetPosZ());
+ return;
+ }
+ else if (std::max(a_Chunk.GetBlockLight(a_RelX, a_RelY + 1, a_RelZ), a_Chunk.GetTimeAlteredLight(a_Chunk.GetSkyLight(a_RelX, a_RelY + 1, a_RelZ))) < 9)
+ {
+ // Source block is not bright enough to spread
+ return;
+ }
+
// Grass spreads to adjacent dirt blocks:
cFastRandom rand;
for (int i = 0; i < 2; i++) // Pick two blocks to grow to