MCPcopy Create free account
hub / github.com/cuberite/cuberite / HandleDaylightSensor

Method HandleDaylightSensor

src/Simulator/IncrementalRedstoneSimulator.cpp:1004–1021  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1002
1003
1004void cIncrementalRedstoneSimulator::HandleDaylightSensor(int a_BlockX, int a_BlockY, int a_BlockZ)
1005{
1006 int a_ChunkX, a_ChunkZ;
1007 cChunkDef::BlockToChunk(a_BlockX, a_BlockZ, a_ChunkX, a_ChunkZ);
1008
1009 if (!m_World.IsChunkLighted(a_ChunkX, a_ChunkZ))
1010 {
1011 m_World.QueueLightChunk(a_ChunkX, a_ChunkZ);
1012 }
1013 else
1014 {
1015 NIBBLETYPE SkyLight = m_World.GetBlockSkyLight(a_BlockX, a_BlockY + 1, a_BlockZ) - m_World.GetSkyDarkness();
1016 if (SkyLight > 8)
1017 {
1018 SetAllDirsAsPowered(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_DAYLIGHT_SENSOR);
1019 }
1020 }
1021}
1022
1023
1024

Callers

nothing calls this directly

Calls 4

QueueLightChunkMethod · 0.80
GetSkyDarknessMethod · 0.80
IsChunkLightedMethod · 0.45
GetBlockSkyLightMethod · 0.45

Tested by

no test coverage detected