diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2020-09-22 12:08:12 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@outlook.com> | 2020-09-23 15:34:15 +0200 |
commit | 71b96ab921bed0371d7c75ac4a2db99b94591de2 (patch) | |
tree | 618e9e37799cbf07a55f4a3950071e067358753f /src/Blocks/BlockSeaLantern.h | |
parent | Added dtEnvitonment to player damage text (#4925) (diff) | |
download | cuberite-71b96ab921bed0371d7c75ac4a2db99b94591de2.tar cuberite-71b96ab921bed0371d7c75ac4a2db99b94591de2.tar.gz cuberite-71b96ab921bed0371d7c75ac4a2db99b94591de2.tar.bz2 cuberite-71b96ab921bed0371d7c75ac4a2db99b94591de2.tar.lz cuberite-71b96ab921bed0371d7c75ac4a2db99b94591de2.tar.xz cuberite-71b96ab921bed0371d7c75ac4a2db99b94591de2.tar.zst cuberite-71b96ab921bed0371d7c75ac4a2db99b94591de2.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Blocks/BlockSeaLantern.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/Blocks/BlockSeaLantern.h b/src/Blocks/BlockSeaLantern.h index 1fab10a11..2ff100d85 100644 --- a/src/Blocks/BlockSeaLantern.h +++ b/src/Blocks/BlockSeaLantern.h @@ -6,6 +6,7 @@ + class cBlockSeaLanternHandler : public cBlockHandler { @@ -24,13 +25,13 @@ private: { return cItem(E_BLOCK_SEA_LANTERN, 1, 0); } - else - { - unsigned int DropNum = GetRandomProvider().RandInt<char>(2, 3 + ToolFortuneLevel(a_Tool)); - // cap the dropnum to the max amount of 5 - DropNum = std::min<unsigned int>(DropNum, 5); - // Reset meta to 0 - return cItem(E_ITEM_PRISMARINE_CRYSTALS, DropNum, 0); - } + + // Number of crystals to drop, capped at the max amount of 5. + const auto Drops = std::min( + static_cast<char>(5), + GetRandomProvider().RandInt<char>(2, 3 + ToolFortuneLevel(a_Tool)) + ); + + return cItem(E_ITEM_PRISMARINE_CRYSTALS, Drops); } } ; |