diff options
author | madmaxoft <github@xoft.cz> | 2014-07-15 22:42:00 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2014-07-15 22:42:00 +0200 |
commit | 3f8ec7699f0205a0346c32df49e2faf509995850 (patch) | |
tree | b61f06d0001d3fd3238f80b5a2304595bbb28c6e /src/Blocks/ClearMetaOnDrop.h | |
parent | Restructured cSplashPotionEntity code. (diff) | |
parent | Merge pull request #1191 from Masy98/Blocks (diff) | |
download | cuberite-3f8ec7699f0205a0346c32df49e2faf509995850.tar cuberite-3f8ec7699f0205a0346c32df49e2faf509995850.tar.gz cuberite-3f8ec7699f0205a0346c32df49e2faf509995850.tar.bz2 cuberite-3f8ec7699f0205a0346c32df49e2faf509995850.tar.lz cuberite-3f8ec7699f0205a0346c32df49e2faf509995850.tar.xz cuberite-3f8ec7699f0205a0346c32df49e2faf509995850.tar.zst cuberite-3f8ec7699f0205a0346c32df49e2faf509995850.zip |
Diffstat (limited to 'src/Blocks/ClearMetaOnDrop.h')
-rw-r--r-- | src/Blocks/ClearMetaOnDrop.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/Blocks/ClearMetaOnDrop.h b/src/Blocks/ClearMetaOnDrop.h new file mode 100644 index 000000000..3f8c33819 --- /dev/null +++ b/src/Blocks/ClearMetaOnDrop.h @@ -0,0 +1,24 @@ + +#pragma once + +// mixin for use to clear meta values when the block is converted to a pickup + +// Usage: inherit from this class, passing the parent class as the parameter Base +// For example to use in class Foo which should inherit Bar use +// class Foo : public cClearMetaOnDrop<Bar>; + +template<class Base> +class cClearMetaOnDrop : public Base +{ +public: + + cClearMetaOnDrop(BLOCKTYPE a_BlockType) : + Base(a_BlockType) + {} + + virtual ~cClearMetaOnDrop() {} + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + { + a_Pickups.push_back(cItem(this->m_BlockType)); + } +}; |