diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2020-05-07 21:29:11 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@outlook.com> | 2020-05-08 11:52:35 +0200 |
commit | 6ac11925f1f1686d83eb932b5fd6b5e0a8252a54 (patch) | |
tree | fa138ce62b5fa135554af8111c6b581082743932 /src/Simulator/IncrementalRedstoneSimulator | |
parent | Use Vector3 for cLineBlockTracer and cBlockTracer (#4715) (diff) | |
download | cuberite-6ac11925f1f1686d83eb932b5fd6b5e0a8252a54.tar cuberite-6ac11925f1f1686d83eb932b5fd6b5e0a8252a54.tar.gz cuberite-6ac11925f1f1686d83eb932b5fd6b5e0a8252a54.tar.bz2 cuberite-6ac11925f1f1686d83eb932b5fd6b5e0a8252a54.tar.lz cuberite-6ac11925f1f1686d83eb932b5fd6b5e0a8252a54.tar.xz cuberite-6ac11925f1f1686d83eb932b5fd6b5e0a8252a54.tar.zst cuberite-6ac11925f1f1686d83eb932b5fd6b5e0a8252a54.zip |
Diffstat (limited to 'src/Simulator/IncrementalRedstoneSimulator')
-rw-r--r-- | src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h b/src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h index 7a420769b..27e5a965c 100644 --- a/src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h +++ b/src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h @@ -14,25 +14,23 @@ class cRedstoneWireHandler: 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) { case E_BLOCK_REDSTONE_REPEATER_ON: case E_BLOCK_REDSTONE_REPEATER_OFF: - /** Check when repeater is in x direction */ + { 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)) { - /** Check if Block is not aligned in in x direction */ - 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); + // Wire connects to repeater if repeater is aligned along X + // and wire is in front or behind it (#4639) + return a_Offset.x != 0; } + + return a_Offset.z != 0; + } case E_BLOCK_ACTIVE_COMPARATOR: case E_BLOCK_INACTIVE_COMPARATOR: 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; auto YPTerraceBlock = a_World.GetBlock(a_Position + OffsetYP()); |