summaryrefslogtreecommitdiffstats
path: root/src/Simulator
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-12-23 00:20:43 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-12-23 00:20:43 +0100
commit11fbfb458d3da8dcba4fdc2d65783a90b660e62d (patch)
treea876e34b7eae6f9d3c6694c6544e10892e952ace /src/Simulator
parentA fix for daylight sensors (diff)
downloadcuberite-11fbfb458d3da8dcba4fdc2d65783a90b660e62d.tar
cuberite-11fbfb458d3da8dcba4fdc2d65783a90b660e62d.tar.gz
cuberite-11fbfb458d3da8dcba4fdc2d65783a90b660e62d.tar.bz2
cuberite-11fbfb458d3da8dcba4fdc2d65783a90b660e62d.tar.lz
cuberite-11fbfb458d3da8dcba4fdc2d65783a90b660e62d.tar.xz
cuberite-11fbfb458d3da8dcba4fdc2d65783a90b660e62d.tar.zst
cuberite-11fbfb458d3da8dcba4fdc2d65783a90b660e62d.zip
Diffstat (limited to 'src/Simulator')
-rw-r--r--src/Simulator/RedstoneSimulator.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/Simulator/RedstoneSimulator.cpp b/src/Simulator/RedstoneSimulator.cpp
index c26663aa1..3e267525f 100644
--- a/src/Simulator/RedstoneSimulator.cpp
+++ b/src/Simulator/RedstoneSimulator.cpp
@@ -899,18 +899,20 @@ void cRedstoneSimulator::HandleNoteBlock(int a_BlockX, int a_BlockY, int a_Block
void cRedstoneSimulator::HandleDaylightSensor(int a_BlockX, int a_BlockY, int a_BlockZ)
{
- for (int Y = a_BlockY + 1; Y < cChunkDef::Height; Y++)
+ int a_ChunkX, a_ChunkZ;
+ cChunkDef::BlockToChunk(a_BlockX, a_BlockZ, a_ChunkX, a_ChunkZ);
+
+ if (!m_World.IsChunkLighted(a_ChunkX, a_ChunkZ))
{
- if (!g_BlockTransparent[m_World.GetBlock(a_BlockX, Y, a_BlockZ)])
- {
- return;
- }
+ m_World.QueueLightChunk(a_ChunkX, a_ChunkZ);
}
-
- NIBBLETYPE SkyLight = m_World.GetBlockSkyLight(a_BlockX, a_BlockY + 1, a_BlockZ) - m_World.GetSkyDarkness();
- if (SkyLight > 8)
+ else
{
- SetAllDirsAsPowered(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_DAYLIGHT_SENSOR);
+ NIBBLETYPE SkyLight = m_World.GetBlockSkyLight(a_BlockX, a_BlockY + 1, a_BlockZ) - m_World.GetSkyDarkness();
+ if (SkyLight > 8)
+ {
+ SetAllDirsAsPowered(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_DAYLIGHT_SENSOR);
+ }
}
}