diff options
author | Marc_Bornand <bornand.m3@gmail.com> | 2020-05-02 22:15:46 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@outlook.com> | 2020-05-03 12:51:11 +0200 |
commit | 055c9ef90ef8c9bb97a5f28ed5151899e1630e5e (patch) | |
tree | 6df3ec310e3aceae73d3316b310e47e03bb6cecc /src/Simulator | |
parent | Modify pickup collection behaviour to correspond to vanilla. (diff) | |
download | cuberite-055c9ef90ef8c9bb97a5f28ed5151899e1630e5e.tar cuberite-055c9ef90ef8c9bb97a5f28ed5151899e1630e5e.tar.gz cuberite-055c9ef90ef8c9bb97a5f28ed5151899e1630e5e.tar.bz2 cuberite-055c9ef90ef8c9bb97a5f28ed5151899e1630e5e.tar.lz cuberite-055c9ef90ef8c9bb97a5f28ed5151899e1630e5e.tar.xz cuberite-055c9ef90ef8c9bb97a5f28ed5151899e1630e5e.tar.zst cuberite-055c9ef90ef8c9bb97a5f28ed5151899e1630e5e.zip |
Diffstat (limited to 'src/Simulator')
-rw-r--r-- | src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h b/src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h index 32be166b1..752df4822 100644 --- a/src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h +++ b/src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h @@ -14,12 +14,34 @@ class cRedstoneWireHandler: public: - inline static bool IsDirectlyConnectingMechanism(BLOCKTYPE a_Block) + inline static bool IsDirectlyConnectingMechanism(cWorld & a_World, BLOCKTYPE a_Block, Vector3i a_QueryPosition, Vector3i a_Offset) { switch (a_Block) { case E_BLOCK_REDSTONE_REPEATER_ON: case E_BLOCK_REDSTONE_REPEATER_OFF: + if ((a_World.GetBlockMeta(a_QueryPosition) & 0x1) == 1) + { + if (a_Offset.x == 0) + { + return false; + } + else + { + return true; + } + } + else + { + if (a_Offset.z == 0) + { + return false; + } + else + { + return true; + } + } case E_BLOCK_ACTIVE_COMPARATOR: case E_BLOCK_INACTIVE_COMPARATOR: case E_BLOCK_REDSTONE_TORCH_OFF: @@ -72,14 +94,14 @@ public: a_Meta++; } - if ((a_QueryPosition != (a_Position + OffsetYM())) && !IsDirectlyConnectingMechanism(a_QueryBlockType)) + if ((a_QueryPosition != (a_Position + OffsetYM())) && !IsDirectlyConnectingMechanism(a_World, a_QueryBlockType, a_QueryPosition, a_QueryPosition - a_Position)) { Vector3i PotentialOffset; bool FoundOneBorderingMechanism = false; for (const auto & Offset : StaticAppend(GetRelativeLaterals(), GetTerracingConnectionOffsets(a_World, a_Position))) { - if (IsDirectlyConnectingMechanism(a_World.GetBlock(Offset + a_Position))) + if (IsDirectlyConnectingMechanism(a_World, a_World.GetBlock(Offset + a_Position), a_QueryPosition, Offset)) { if (FoundOneBorderingMechanism) { |