diff options
author | peterbell10 <peterbell10@live.co.uk> | 2020-10-05 12:27:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-05 12:27:14 +0200 |
commit | a9031b6bae742b333b1b390192fa590f2ecb07ea (patch) | |
tree | b2802c81d24d339c201a0747d66ba44e9ea8b1b0 /src/Blocks/Mixins.h | |
parent | Fixed current end generator (#4968) (diff) | |
download | cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.gz cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.bz2 cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.lz cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.xz cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.zst cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Blocks/Mixins.h | 44 |
1 files changed, 15 insertions, 29 deletions
diff --git a/src/Blocks/Mixins.h b/src/Blocks/Mixins.h index a5c3e751e..0a356fe58 100644 --- a/src/Blocks/Mixins.h +++ b/src/Blocks/Mixins.h @@ -25,33 +25,9 @@ class cBlockLadder: public cMetaRotator<cClearMetaOnDrop, ...> -template <class Base = cBlockHandler> -class cBlockWithNoDrops: - public Base -{ -public: - - constexpr cBlockWithNoDrops(BLOCKTYPE a_BlockType): - Base(a_BlockType) - { - } - -private: - - virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override - { - // Don't drop anything: - return {}; - } -}; - - - - - /** Mixin to clear the block's meta value when converting to a pickup. */ template <class Base> -class cClearMetaOnDrop: +class cClearMetaOnDrop : public Base { public: @@ -61,6 +37,10 @@ public: { } +protected: + + ~cClearMetaOnDrop() = default; + private: virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override @@ -78,7 +58,7 @@ private: 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. */ template <class Base, NIBBLETYPE BitMask, NIBBLETYPE North, NIBBLETYPE East, NIBBLETYPE South, NIBBLETYPE West, bool AssertIfNotMatched = false> -class cMetaRotator: +class cMetaRotator : public Base { public: @@ -90,6 +70,8 @@ public: protected: + ~cMetaRotator() = default; + virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) const override { NIBBLETYPE OtherMeta = a_Meta & (~BitMask); @@ -176,7 +158,7 @@ template < NIBBLETYPE West = 0x04, bool AssertIfNotMatched = false > -class cYawRotator: +class cYawRotator : public cMetaRotator<Base, BitMask, North, East, South, West, AssertIfNotMatched> { using Super = cMetaRotator<Base, BitMask, North, East, South, West, AssertIfNotMatched>; @@ -185,8 +167,6 @@ public: using Super::Super; -public: - virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer & a_Player, const Vector3i a_BlockPos, @@ -230,6 +210,10 @@ public: return North; } } + +protected: + + ~cYawRotator() = default; }; @@ -259,6 +243,8 @@ public: protected: + ~cPitchYawRotator() = default; + virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer & a_Player, |