From 71b96ab921bed0371d7c75ac4a2db99b94591de2 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Tue, 22 Sep 2020 11:08:12 +0100 Subject: Limit fortune level, style fixes --- src/Blocks/BlockGlowstone.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/Blocks/BlockGlowstone.h') 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(2, 4 + ToolFortuneLevel(a_Tool)); - // cap the dropnum to the max amount of 4 - DropNum = std::min(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(4), + GetRandomProvider().RandInt(2, 4 + ToolFortuneLevel(a_Tool)) + ); + + return cItem(E_ITEM_GLOWSTONE_DUST, Drops); } -- cgit v1.2.3