diff options
author | Alexander Harkness <me@bearbin.net> | 2020-04-09 22:18:45 +0200 |
---|---|---|
committer | Alexander Harkness <me@bearbin.net> | 2020-04-10 15:07:16 +0200 |
commit | 2b77b67197a54eef22032b6d8b220bbcaf7c1e67 (patch) | |
tree | 97ff36515fa5d93769e221fb934b992323724012 | |
parent | Add mixins for blocks that rotate based on player yaw at placement (diff) | |
download | cuberite-2b77b67197a54eef22032b6d8b220bbcaf7c1e67.tar cuberite-2b77b67197a54eef22032b6d8b220bbcaf7c1e67.tar.gz cuberite-2b77b67197a54eef22032b6d8b220bbcaf7c1e67.tar.bz2 cuberite-2b77b67197a54eef22032b6d8b220bbcaf7c1e67.tar.lz cuberite-2b77b67197a54eef22032b6d8b220bbcaf7c1e67.tar.xz cuberite-2b77b67197a54eef22032b6d8b220bbcaf7c1e67.tar.zst cuberite-2b77b67197a54eef22032b6d8b220bbcaf7c1e67.zip |
-rw-r--r-- | src/Blocks/Mixins.h | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/Blocks/Mixins.h b/src/Blocks/Mixins.h index 2ab83a4d5..25f2372a0 100644 --- a/src/Blocks/Mixins.h +++ b/src/Blocks/Mixins.h @@ -167,9 +167,8 @@ public: }; -/** Mixin for rotations and reflections following the standard pattern of "apply mask, then use a switch". -Inherit from this class providing your base class as Base, the BitMask for the direction bits in bitmask and the masked value for the directions in North, East, South, West. -There is also an aptional parameter AssertIfNotMatched, set this if it is invalid for a block to exist in any other state. */ +/** Mixin for blocks whose meta on placement depends on the yaw of the player placing the block. BitMask +selects the direction bits from the block's meta values. */ template <class Base, NIBBLETYPE BitMask = 0x7, NIBBLETYPE North = 0x2, NIBBLETYPE East = 0x5, NIBBLETYPE South = 0x3, NIBBLETYPE West = 0x4, bool AssertIfNotMatched = false> class cYawRotator: public cMetaRotator<Base, BitMask, North, East, South, West, AssertIfNotMatched> @@ -230,9 +229,8 @@ public: } }; -/** Mixin for rotations and reflections following the standard pattern of "apply mask, then use a switch". -Inherit from this class providing your base class as Base, the BitMask for the direction bits in bitmask and the masked value for the directions in North, East, South, West. -There is also an aptional parameter AssertIfNotMatched, set this if it is invalid for a block to exist in any other state. */ +/** Mixin for blocks whose meta on placement depends on the pitch and yaw of the player placing the block. BitMask +selects the direction bits from the block's meta values. */ template <class Base, NIBBLETYPE BitMask = 0x7, NIBBLETYPE North = 0x2, NIBBLETYPE East = 0x5, NIBBLETYPE South = 0x3, NIBBLETYPE West = 0x4, NIBBLETYPE Up = 0x1, NIBBLETYPE Down = 0x0> class cPitchYawRotator: public cYawRotator<Base, BitMask, North, East, South, West> @@ -268,9 +266,7 @@ public: virtual NIBBLETYPE MetaMirrorXZ(NIBBLETYPE a_Meta) override { - // Bit 0x08 is a flag. Lowest three bits are position. NIBBLETYPE OtherMeta = a_Meta & (~BitMask); - // Mirrors defined by a table. (Source, minecraft.gamepedia.com) switch (a_Meta & BitMask) { case Down: return Up | OtherMeta; // Down -> Up |