diff options
author | Mattes D <github@xoft.cz> | 2014-03-08 18:27:24 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-03-08 18:27:24 +0100 |
commit | 3a6499b192b4d0cf28d960a5f9ac09ee44265d5c (patch) | |
tree | 3fabece6b0dbac4c229453c81f1a57bb248ef9b8 /src/Blocks/BlockDropSpenser.h | |
parent | Merge pull request #770 from xdot/master (diff) | |
parent | Moved returns (diff) | |
download | cuberite-3a6499b192b4d0cf28d960a5f9ac09ee44265d5c.tar cuberite-3a6499b192b4d0cf28d960a5f9ac09ee44265d5c.tar.gz cuberite-3a6499b192b4d0cf28d960a5f9ac09ee44265d5c.tar.bz2 cuberite-3a6499b192b4d0cf28d960a5f9ac09ee44265d5c.tar.lz cuberite-3a6499b192b4d0cf28d960a5f9ac09ee44265d5c.tar.xz cuberite-3a6499b192b4d0cf28d960a5f9ac09ee44265d5c.tar.zst cuberite-3a6499b192b4d0cf28d960a5f9ac09ee44265d5c.zip |
Diffstat (limited to 'src/Blocks/BlockDropSpenser.h')
-rw-r--r-- | src/Blocks/BlockDropSpenser.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/Blocks/BlockDropSpenser.h b/src/Blocks/BlockDropSpenser.h index 30d347ec9..7e0ad0e55 100644 --- a/src/Blocks/BlockDropSpenser.h +++ b/src/Blocks/BlockDropSpenser.h @@ -6,17 +6,18 @@ #pragma once #include "../Piston.h" +#include "MetaRotater.h" class cBlockDropSpenserHandler : - public cBlockEntityHandler + public cMetaRotater<cBlockEntityHandler, 0x07, 0x02, 0x05, 0x03, 0x04> { public: cBlockDropSpenserHandler(BLOCKTYPE a_BlockType) : - cBlockEntityHandler(a_BlockType) + cMetaRotater<cBlockEntityHandler, 0x07, 0x02, 0x05, 0x03, 0x04>(a_BlockType) { } @@ -34,6 +35,20 @@ public: a_BlockMeta = cPiston::RotationPitchToMetaData(a_Player->GetYaw(), a_Player->GetPitch()); return true; } + + virtual NIBBLETYPE MetaMirrorXZ(NIBBLETYPE a_Meta) override + { + // Bit 0x08 is a flag. Lowest three bits are position. 0x08 == 1000 + NIBBLETYPE OtherMeta = a_Meta & 0x08; + // Mirrors defined by by a table. (Source, mincraft.gamepedia.com) 0x07 == 0111 + switch (a_Meta & 0x07) + { + case 0x00: return 0x01 + OtherMeta; // Down -> Up + case 0x01: return 0x00 + OtherMeta; // Up -> Down + } + // Not Facing Up or Down; No change. + return a_Meta; + } } ; |