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/BlockFluid.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/BlockFluid.h | 72 |
1 files changed, 39 insertions, 33 deletions
diff --git a/src/Blocks/BlockFluid.h b/src/Blocks/BlockFluid.h index 05a7c0d62..70aa57a0d 100644 --- a/src/Blocks/BlockFluid.h +++ b/src/Blocks/BlockFluid.h @@ -7,7 +7,7 @@ -class cBlockFluidHandler: +class cBlockFluidHandler : public cBlockHandler { using Super = cBlockHandler; @@ -16,6 +16,10 @@ public: using Super::Super; +protected: + + ~cBlockFluidHandler() = default; + private: virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override @@ -32,44 +36,13 @@ private: { return true; } - - - - - - virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override - { - UNUSED(a_Meta); - if (IsBlockWater(m_BlockType)) - { - return 12; - } - ASSERT(!"Unhandled blocktype in fluid/water handler!"); - return 0; - } - - - - - - virtual bool CanSustainPlant(BLOCKTYPE a_Plant) const override - { - return ( - (a_Plant == E_BLOCK_BEETROOTS) || - (a_Plant == E_BLOCK_CROPS) || - (a_Plant == E_BLOCK_CARROTS) || - (a_Plant == E_BLOCK_POTATOES) || - (a_Plant == E_BLOCK_MELON_STEM) || - (a_Plant == E_BLOCK_PUMPKIN_STEM) - ); - } } ; -class cBlockLavaHandler: +class cBlockLavaHandler final : public cBlockFluidHandler { using Super = cBlockFluidHandler; @@ -173,3 +146,36 @@ private: + +class cBlockWaterHandler final : + public cBlockFluidHandler +{ +public: + + using cBlockFluidHandler::cBlockFluidHandler; + +private: + + virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override + { + UNUSED(a_Meta); + if (IsBlockWater(m_BlockType)) + { + return 12; + } + ASSERT(!"Unhandled blocktype in fluid/water handler!"); + return 0; + } + + virtual bool CanSustainPlant(BLOCKTYPE a_Plant) const override + { + return ( + (a_Plant == E_BLOCK_BEETROOTS) || + (a_Plant == E_BLOCK_CROPS) || + (a_Plant == E_BLOCK_CARROTS) || + (a_Plant == E_BLOCK_POTATOES) || + (a_Plant == E_BLOCK_MELON_STEM) || + (a_Plant == E_BLOCK_PUMPKIN_STEM) + ); + } +}; |