4 #include "../../Blocks/BlockRedstoneRepeater.h"
26 return std::make_pair(
false,
static_cast<NIBBLETYPE>(0));
29 return std::make_pair(
IsOn(
Type), Meta);
73 const auto Lhs =
IsOnRepeater(Chunk, LhsOffset + a_Position);
80 const auto Rhs =
IsOnRepeater(Chunk, -LhsOffset + a_Position);
86 if (!
IsOn(a_BlockType))
92 const auto FrontPosition = a_Position + FrontOffset;
93 if (a_QueryPosition == FrontPosition)
106 const auto DelayInfo = Data.GetMechanismDelayInfo(a_Position);
109 if (
IsLocked(a_Chunk, a_Position, a_Meta))
111 if (DelayInfo !=
nullptr)
113 Data.m_MechanismDelays.erase(a_Position);
119 if (DelayInfo ==
nullptr)
121 bool ShouldBeOn = (
Power != 0);
122 if (ShouldBeOn !=
IsOn(a_BlockType))
124 Data.m_MechanismDelays[a_Position] = std::make_pair((((a_Meta & 0xC) >> 0x2) + 1), ShouldBeOn);
141 Data.m_MechanismDelays.erase(a_Position);
146 Update(a_Chunk, CurrentlyTicking, a_Position, NewType, a_Meta,
Power);
@ E_META_REDSTONE_REPEATER_FACING_XP
@ E_META_REDSTONE_REPEATER_FACING_ZP
@ E_META_REDSTONE_REPEATER_FACING_MASK
@ E_META_REDSTONE_REPEATER_FACING_ZM
@ E_META_REDSTONE_REPEATER_FACING_XM
@ E_BLOCK_REDSTONE_REPEATER_ON
@ E_BLOCK_REDSTONE_REPEATER_OFF
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
unsigned char BLOCKTYPE
The datatype used by blockdata.
auto & DataForChunk(const cChunk &a_Chunk)
void UpdateAdjustedRelative(const cChunk &a_Chunk, const cChunk &a_TickingChunk, const Vector3i a_Position, const Vector3i a_Offset)
unsigned char Power(const BlockState Block)
static bool ShouldPowerOn(cChunk &Chunk, const Vector3i a_Position, NIBBLETYPE a_Meta, cIncrementalRedstoneSimulatorChunkData &a_Data)
static void ForValidSourcePositions(const cChunk &a_Chunk, Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta, ForEachSourceCallback &Callback)
static void Update(cChunk &a_Chunk, cChunk &CurrentlyTicking, Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta, const PowerLevel Power)
static bool IsLocked(cChunk &Chunk, const Vector3i a_Position, const NIBBLETYPE a_Meta)
Determine if a repeater is locked.
static PowerLevel GetPowerDeliveredToPosition(const cChunk &a_Chunk, Vector3i a_Position, BLOCKTYPE a_BlockType, Vector3i a_QueryPosition, BLOCKTYPE a_QueryBlockType, bool IsLinked)
static std::pair< bool, NIBBLETYPE > IsOnRepeater(cChunk &Chunk, const Vector3i a_Position)
Returns a pair with first element indicating if the block at the given position is an activated repea...
static bool DoesLhsLockMe(NIBBLETYPE a_MetaLhs, NIBBLETYPE a_MyMeta)
Determine, from the metadata of a repeater on our left side, if they lock us.
static bool IsOn(BLOCKTYPE a_Block)
static Vector3i GetLeftCoordinateOffset(NIBBLETYPE a_Meta)
static Vector3i GetFrontCoordinateOffset(NIBBLETYPE a_Meta)
static Vector3i GetRearCoordinateOffset(NIBBLETYPE a_Meta)
NIBBLETYPE GetMeta(int a_RelX, int a_RelY, int a_RelZ) const
void FastSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, BLOCKTYPE a_BlockMeta)
bool UnboundedRelGetBlock(Vector3i a_RelCoords, BLOCKTYPE &a_BlockType, NIBBLETYPE &a_BlockMeta) const
Same as GetBlock(), but relative coords needn't be in this chunk (uses m_Neighbor-s or m_ChunkMap in ...