summaryrefslogtreecommitdiffstats
path: root/src/Simulator/IncrementalRedstoneSimulator
diff options
context:
space:
mode:
authorMarc_Bornand <bornand.m3@gmail.com>2020-05-03 00:08:52 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-05-03 12:51:11 +0200
commit83193f132c994e8ca4ceda86e9f28b2db214d45a (patch)
tree8f11467b9ed4d4fbb33aa066fcb86e7c32cbcd01 /src/Simulator/IncrementalRedstoneSimulator
parentadd me to the contributors (diff)
downloadcuberite-83193f132c994e8ca4ceda86e9f28b2db214d45a.tar
cuberite-83193f132c994e8ca4ceda86e9f28b2db214d45a.tar.gz
cuberite-83193f132c994e8ca4ceda86e9f28b2db214d45a.tar.bz2
cuberite-83193f132c994e8ca4ceda86e9f28b2db214d45a.tar.lz
cuberite-83193f132c994e8ca4ceda86e9f28b2db214d45a.tar.xz
cuberite-83193f132c994e8ca4ceda86e9f28b2db214d45a.tar.zst
cuberite-83193f132c994e8ca4ceda86e9f28b2db214d45a.zip
Diffstat (limited to 'src/Simulator/IncrementalRedstoneSimulator')
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h b/src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h
index 752df4822..dfb35a9bf 100644
--- a/src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h
+++ b/src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h
@@ -14,14 +14,17 @@ class cRedstoneWireHandler:
public:
- inline static bool IsDirectlyConnectingMechanism(cWorld & a_World, BLOCKTYPE a_Block, Vector3i a_QueryPosition, Vector3i a_Offset)
+ inline static bool IsDirectlyConnectingMechanism(BLOCKTYPE a_Block, NIBBLETYPE a_BlockMeta, 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)
+ /** 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 */
if (a_Offset.x == 0)
{
return false;
@@ -31,8 +34,10 @@ public:
return true;
}
}
+ /** when repeater is in z direction */
else
{
+ /** Check if block is not aligned in z direction */
if (a_Offset.z == 0)
{
return false;
@@ -94,14 +99,14 @@ public:
a_Meta++;
}
- if ((a_QueryPosition != (a_Position + OffsetYM())) && !IsDirectlyConnectingMechanism(a_World, a_QueryBlockType, a_QueryPosition, a_QueryPosition - a_Position))
+ if ((a_QueryPosition != (a_Position + OffsetYM())) && !IsDirectlyConnectingMechanism( a_QueryBlockType, a_Meta, a_QueryPosition - a_Position))
{
Vector3i PotentialOffset;
bool FoundOneBorderingMechanism = false;
for (const auto & Offset : StaticAppend(GetRelativeLaterals(), GetTerracingConnectionOffsets(a_World, a_Position)))
{
- if (IsDirectlyConnectingMechanism(a_World, a_World.GetBlock(Offset + a_Position), a_QueryPosition, Offset))
+ if (IsDirectlyConnectingMechanism(a_World.GetBlock(Offset + a_Position), a_Meta, Offset))
{
if (FoundOneBorderingMechanism)
{