diff options
author | Mattes D <github@xoft.cz> | 2017-06-08 18:48:15 +0200 |
---|---|---|
committer | Lukas Pioch <lukas@zgow.de> | 2017-06-09 12:17:27 +0200 |
commit | c82facab1b1fabd30fefbe28f66808849317532e (patch) | |
tree | 3d9f43b40b2411ecfcadf1750e73888809e9dfdd | |
parent | Added WriteBlockEntity to 1.10 and 1.11 and fixed mob spawner (diff) | |
download | cuberite-c82facab1b1fabd30fefbe28f66808849317532e.tar cuberite-c82facab1b1fabd30fefbe28f66808849317532e.tar.gz cuberite-c82facab1b1fabd30fefbe28f66808849317532e.tar.bz2 cuberite-c82facab1b1fabd30fefbe28f66808849317532e.tar.lz cuberite-c82facab1b1fabd30fefbe28f66808849317532e.tar.xz cuberite-c82facab1b1fabd30fefbe28f66808849317532e.tar.zst cuberite-c82facab1b1fabd30fefbe28f66808849317532e.zip |
Diffstat (limited to '')
-rw-r--r-- | src/LightingThread.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/LightingThread.cpp b/src/LightingThread.cpp index 4e2826778..302be4d02 100644 --- a/src/LightingThread.cpp +++ b/src/LightingThread.cpp @@ -368,7 +368,18 @@ void cLightingThread::PrepareSkyLight(void) for (int x = 1; x < cChunkDef::Width * 3 - 1; x++) { int idx = BaseZ + x; - int Current = m_HeightMap[idx] + 1; + // Find the lowest block in this column that receives full sunlight (go through transparent blocks): + int Current = m_HeightMap[idx]; + ASSERT(Current < cChunkDef::Height); + while ( + (Current >= 0) && + cBlockInfo::IsTransparent(m_BlockTypes[idx + Current * BlocksPerYLayer]) + ) + { + Current -= 1; // Sunlight goes down unchanged through this block + } + Current += 1; // Point to the last sunlit block, rather than the first non-transparent one + // The other neighbors don't need transparent-block-checking. At worst we'll have a few dud seeds above the ground. int Neighbor1 = m_HeightMap[idx + 1] + 1; // X + 1 int Neighbor2 = m_HeightMap[idx - 1] + 1; // X - 1 int Neighbor3 = m_HeightMap[idx + cChunkDef::Width * 3] + 1; // Z + 1 |