21 const auto ProportionOfDay = a_Chunk.
GetWorld()->
GetTimeOfDay().count() * (
static_cast<float>(M_PI) / 12000.f);
24 const auto RawOutput = a_Chunk.
GetSkyLightAltered(a_Position) * (0.6f * std::sin(ProportionOfDay) + 0.5f);
27 return static_cast<PowerLevel>(std::clamp(RawOutput, 0.f, 15.f));
37 return IsLinked ? 0 : a_Chunk.
GetMeta(a_Position);
@ E_BLOCK_INVERTED_DAYLIGHT_SENSOR
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
unsigned char BLOCKTYPE
The datatype used by blockdata.
constexpr std::array< Vector3i, 6 > RelativeAdjacents
void UpdateAdjustedRelatives(const cChunk &a_Chunk, const cChunk &a_TickingChunk, const Vector3i a_Position, const ArrayType &a_Relative)
unsigned char Power(const BlockState Block)
static PowerLevel GetPowerDeliveredToPosition(const cChunk &a_Chunk, Vector3i a_Position, BLOCKTYPE a_BlockType, Vector3i a_QueryPosition, BLOCKTYPE a_QueryBlockType, bool IsLinked)
static void Update(cChunk &a_Chunk, cChunk &CurrentlyTicking, Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta, const PowerLevel Power)
static void ForValidSourcePositions(const cChunk &a_Chunk, Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta, ForEachSourceCallback &Callback)
static PowerLevel GetPowerLevel(const cChunk &a_Chunk, const Vector3i a_Position)
NIBBLETYPE GetMeta(int a_RelX, int a_RelY, int a_RelZ) const
BLOCKTYPE GetBlock(int a_RelX, int a_RelY, int a_RelZ) const
NIBBLETYPE GetSkyLightAltered(Vector3i a_RelPos) const
Get the level of sky light illuminating the block (0 - 15), taking daytime into a account.
void SetMeta(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_Meta)
cWorld * GetWorld(void) const
virtual cTickTime GetTimeOfDay(void) const override