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/BlockSeaLantern.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/Blocks/BlockSeaLantern.h') 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(2, 3 + ToolFortuneLevel(a_Tool)); - // cap the dropnum to the max amount of 5 - DropNum = std::min(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(5), + GetRandomProvider().RandInt(2, 3 + ToolFortuneLevel(a_Tool)) + ); + + return cItem(E_ITEM_PRISMARINE_CRYSTALS, Drops); } } ; -- cgit v1.2.3