1
0
Fork 0

Update RedstoneWireHandler style

This commit is contained in:
Tiger Wang 2020-05-07 20:29:11 +01:00
parent 1565d9b3ce
commit 6ac11925f1
1 changed files with 9 additions and 11 deletions

View File

@ -14,25 +14,23 @@ class cRedstoneWireHandler:
public: public:
inline static bool IsDirectlyConnectingMechanism(BLOCKTYPE a_Block, NIBBLETYPE a_BlockMeta, Vector3i a_Offset) inline static bool IsDirectlyConnectingMechanism(BLOCKTYPE a_Block, NIBBLETYPE a_BlockMeta, const Vector3i a_Offset)
{ {
switch (a_Block) switch (a_Block)
{ {
case E_BLOCK_REDSTONE_REPEATER_ON: case E_BLOCK_REDSTONE_REPEATER_ON:
case E_BLOCK_REDSTONE_REPEATER_OFF: case E_BLOCK_REDSTONE_REPEATER_OFF:
/** Check when repeater is in x direction */ {
a_BlockMeta &= E_META_REDSTONE_REPEATER_FACING_MASK; a_BlockMeta &= E_META_REDSTONE_REPEATER_FACING_MASK;
if ((a_BlockMeta == E_META_REDSTONE_REPEATER_FACING_XP) || (a_BlockMeta == E_META_REDSTONE_REPEATER_FACING_XM)) if ((a_BlockMeta == E_META_REDSTONE_REPEATER_FACING_XP) || (a_BlockMeta == E_META_REDSTONE_REPEATER_FACING_XM))
{ {
/** Check if Block is not aligned in in x direction */ // Wire connects to repeater if repeater is aligned along X
return (a_Offset.x != 0); // and wire is in front or behind it (#4639)
} return a_Offset.x != 0;
/** when repeater is in z direction */
else
{
/** Check if block is not aligned in z direction */
return (a_Offset.z != 0);
} }
return a_Offset.z != 0;
}
case E_BLOCK_ACTIVE_COMPARATOR: case E_BLOCK_ACTIVE_COMPARATOR:
case E_BLOCK_INACTIVE_COMPARATOR: case E_BLOCK_INACTIVE_COMPARATOR:
case E_BLOCK_REDSTONE_TORCH_OFF: case E_BLOCK_REDSTONE_TORCH_OFF:
@ -42,7 +40,7 @@ public:
} }
} }
cVector3iArray GetTerracingConnectionOffsets(cWorld & a_World, Vector3i a_Position) const cVector3iArray GetTerracingConnectionOffsets(cWorld & a_World, const Vector3i a_Position) const
{ {
cVector3iArray RelativePositions; cVector3iArray RelativePositions;
auto YPTerraceBlock = a_World.GetBlock(a_Position + OffsetYP()); auto YPTerraceBlock = a_World.GetBlock(a_Position + OffsetYP());