diff options
Diffstat (limited to 'src/Blocks/BlockSign.h')
-rw-r--r-- | src/Blocks/BlockSign.h | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/src/Blocks/BlockSign.h b/src/Blocks/BlockSign.h index 7fbe61893..9d6fede21 100644 --- a/src/Blocks/BlockSign.h +++ b/src/Blocks/BlockSign.h @@ -2,8 +2,8 @@ #pragma once #include "BlockHandler.h" -#include "../World.h" #include "../Entities/Player.h" +#include "Chunk.h" @@ -31,7 +31,7 @@ public: } - static char RotationToMetaData(double a_Rotation) + static NIBBLETYPE RotationToMetaData(double a_Rotation) { a_Rotation += 180 + (180 / 16); // So it's not aligned with axis if (a_Rotation > 360) @@ -45,7 +45,7 @@ public: } - static char DirectionToMetaData(char a_Direction) + static NIBBLETYPE DirectionToMetaData(eBlockFace a_Direction) { switch (a_Direction) { @@ -63,14 +63,45 @@ public: virtual void OnPlacedByPlayer( - cWorld * a_World, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, + cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta ) override { a_Player->GetClientHandle()->SendEditSign(a_BlockX, a_BlockY, a_BlockZ); } + + + virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) override + { + return (++a_Meta) & 0x0F; + } + + + virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) override + { + return (--a_Meta) & 0x0F; + } + + virtual NIBBLETYPE MetaMirrorXY(NIBBLETYPE a_Meta) override + { + // Mirrors signs over the XY plane (North-South Mirroring) + + // There are 16 meta values which correspond to different directions. + // These values are equated to angles on a circle; 0x08 = 180 degrees. + return (a_Meta < 0x08) ? 0x08 + a_Meta : 0x08 - a_Meta; + } + + + virtual NIBBLETYPE MetaMirrorYZ(NIBBLETYPE a_Meta) override + { + // Mirrors signs over the YZ plane (East-West Mirroring) + + // There are 16 meta values which correspond to different directions. + // These values are equated to angles on a circle; 0x10 = 360 degrees. + return 0x10 - a_Meta; + } } ; |