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/BlockGlowstone.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 'src/Blocks/BlockGlowstone.h')
-rw-r--r-- | src/Blocks/BlockGlowstone.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/Blocks/BlockGlowstone.h b/src/Blocks/BlockGlowstone.h index 930509e0a..11aa5e379 100644 --- a/src/Blocks/BlockGlowstone.h +++ b/src/Blocks/BlockGlowstone.h @@ -6,6 +6,7 @@ + class cBlockGlowstoneHandler : public cBlockHandler { @@ -22,13 +23,14 @@ private: { return cItem(E_BLOCK_GLOWSTONE, 1, 0); } - else - { - unsigned int DropNum = GetRandomProvider().RandInt<char>(2, 4 + ToolFortuneLevel(a_Tool)); - // cap the dropnum to the max amount of 4 - DropNum = std::min<unsigned int>(DropNum, 4); - return cItem(E_ITEM_GLOWSTONE_DUST, DropNum, 0); - } + + // Number of dust to drop, capped at the max amount of 4. + const auto Drops = std::min( + static_cast<char>(4), + GetRandomProvider().RandInt<char>(2, 4 + ToolFortuneLevel(a_Tool)) + ); + + return cItem(E_ITEM_GLOWSTONE_DUST, Drops); } |