summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockRedstoneRepeater.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2015-12-19 22:20:56 +0100
committerTiger Wang <ziwei.tiger@outlook.com>2015-12-19 22:20:56 +0100
commitb8752bb26e91bcdcebfb8dd43e5794251ff70a89 (patch)
tree95048f5a2a833c1d43785f6eaea070627c2b9ebe /src/Blocks/BlockRedstoneRepeater.h
parentMerge pull request #2776 from cuberite/AtomicBoolIsthread (diff)
parentReorganised the redstone simulator (diff)
downloadcuberite-b8752bb26e91bcdcebfb8dd43e5794251ff70a89.tar
cuberite-b8752bb26e91bcdcebfb8dd43e5794251ff70a89.tar.gz
cuberite-b8752bb26e91bcdcebfb8dd43e5794251ff70a89.tar.bz2
cuberite-b8752bb26e91bcdcebfb8dd43e5794251ff70a89.tar.lz
cuberite-b8752bb26e91bcdcebfb8dd43e5794251ff70a89.tar.xz
cuberite-b8752bb26e91bcdcebfb8dd43e5794251ff70a89.tar.zst
cuberite-b8752bb26e91bcdcebfb8dd43e5794251ff70a89.zip
Diffstat (limited to 'src/Blocks/BlockRedstoneRepeater.h')
-rw-r--r--src/Blocks/BlockRedstoneRepeater.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/Blocks/BlockRedstoneRepeater.h b/src/Blocks/BlockRedstoneRepeater.h
index 5f413e10a..033ba82de 100644
--- a/src/Blocks/BlockRedstoneRepeater.h
+++ b/src/Blocks/BlockRedstoneRepeater.h
@@ -110,6 +110,42 @@ public:
UNUSED(a_Meta);
return 11;
}
+
+
+ inline static Vector3i GetRearCoordinateOffset(NIBBLETYPE a_Meta)
+ {
+ switch (a_Meta & 0x3) // 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};
+ default:
+ {
+ LOGWARNING("%s: Unknown metadata: %d", __FUNCTION__, a_Meta);
+ ASSERT(!"Unknown metadata while determining orientation of repeater!");
+ return {0, 0, 0};
+ }
+ }
+ }
+
+
+ inline static Vector3i GetFrontCoordinateOffset(NIBBLETYPE a_Meta)
+ {
+ switch (a_Meta & 0x3) // 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};
+ default:
+ {
+ LOGWARNING("%s: Unknown metadata: %d", __FUNCTION__, a_Meta);
+ ASSERT(!"Unknown metadata while determining orientation of repeater!");
+ return {0, 0, 0};
+ }
+ }
+ }
} ;