summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockRedstoneRepeater.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-04-17 10:40:26 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-04-18 17:51:29 +0200
commitc1ea5f982dc4665c5683dbbe7a3ffe280f6a09cf (patch)
tree3625a60e2e5cb0692e031355e28df5e56b4bf671 /src/Blocks/BlockRedstoneRepeater.h
parentExtended Vector3 (#4666) (diff)
downloadcuberite-c1ea5f982dc4665c5683dbbe7a3ffe280f6a09cf.tar
cuberite-c1ea5f982dc4665c5683dbbe7a3ffe280f6a09cf.tar.gz
cuberite-c1ea5f982dc4665c5683dbbe7a3ffe280f6a09cf.tar.bz2
cuberite-c1ea5f982dc4665c5683dbbe7a3ffe280f6a09cf.tar.lz
cuberite-c1ea5f982dc4665c5683dbbe7a3ffe280f6a09cf.tar.xz
cuberite-c1ea5f982dc4665c5683dbbe7a3ffe280f6a09cf.tar.zst
cuberite-c1ea5f982dc4665c5683dbbe7a3ffe280f6a09cf.zip
Diffstat (limited to '')
-rw-r--r--src/Blocks/BlockRedstoneRepeater.h34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/Blocks/BlockRedstoneRepeater.h b/src/Blocks/BlockRedstoneRepeater.h
index 89cba2d35..25aa9b795 100644
--- a/src/Blocks/BlockRedstoneRepeater.h
+++ b/src/Blocks/BlockRedstoneRepeater.h
@@ -77,38 +77,42 @@ public:
return 11;
}
-
- inline static Vector3i GetRearCoordinateOffset(NIBBLETYPE a_Meta)
+ inline static Vector3i GetLeftCoordinateOffset(NIBBLETYPE a_Meta)
{
- switch (a_Meta & 0x3) // We only want the direction (bottom) bits
+ switch (a_Meta & E_META_REDSTONE_REPEATER_FACING_MASK) // We only want the direction (bottom) bits
{
- case 0x0: return {0, 0, 1};
- case 0x1: return {-1, 0, 0};
- case 0x2: return {0, 0, -1};
- case 0x3: return {1, 0, 0};
+ case E_META_REDSTONE_REPEATER_FACING_ZM: return { -1, 0, 0 };
+ case E_META_REDSTONE_REPEATER_FACING_XP: return { 0, 0, -1 };
+ case E_META_REDSTONE_REPEATER_FACING_ZP: return { 1, 0, 0 };
+ case E_META_REDSTONE_REPEATER_FACING_XM: return { 0, 0, 1 };
+
default:
{
LOGWARNING("%s: Unknown metadata: %d", __FUNCTION__, a_Meta);
ASSERT(!"Unknown metadata while determining orientation of repeater!");
- return {0, 0, 0};
+ return { 0, 0, 0 };
}
}
}
-
inline static Vector3i GetFrontCoordinateOffset(NIBBLETYPE a_Meta)
{
- switch (a_Meta & 0x3) // We only want the direction (bottom) bits
+ return -GetRearCoordinateOffset(a_Meta);
+ }
+
+ inline static Vector3i GetRearCoordinateOffset(NIBBLETYPE a_Meta)
+ {
+ switch (a_Meta & E_META_REDSTONE_REPEATER_FACING_MASK) // We only want the direction (bottom) bits
{
- case 0x0: return {0, 0, -1};
- case 0x1: return {1, 0, 0};
- case 0x2: return {0, 0, 1};
- case 0x3: return {-1, 0, 0};
+ case E_META_REDSTONE_REPEATER_FACING_ZM: return { 0, 0, 1 };
+ case E_META_REDSTONE_REPEATER_FACING_XP: return { -1, 0, 0 };
+ case E_META_REDSTONE_REPEATER_FACING_ZP: return { 0, 0, -1 };
+ case E_META_REDSTONE_REPEATER_FACING_XM: return { 1, 0, 0 };
default:
{
LOGWARNING("%s: Unknown metadata: %d", __FUNCTION__, a_Meta);
ASSERT(!"Unknown metadata while determining orientation of repeater!");
- return {0, 0, 0};
+ return { 0, 0, 0 };
}
}
}