From 5b62c4c3145c08b093521e42c565922fa85de4ad Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 26 Jun 2015 17:24:51 -0500 Subject: Reorganised the redstone simulator -> Many thanks to @worktycho for the idea, and @Haxi52 for the implementation plan! * Uses classes and inheritance now * Speed should be improved --- src/Blocks/BlockRedstoneRepeater.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'src/Blocks/BlockRedstoneRepeater.h') 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}; + } + } + } } ; -- cgit v1.2.3