From b6b7fb1a6549ba0c92c5db141af6f6f9bc1d3038 Mon Sep 17 00:00:00 2001 From: KingCol13 <48412633+KingCol13@users.noreply.github.com> Date: Sun, 20 Sep 2020 19:06:28 +0100 Subject: Implement fortune for ores, glowstone and sea lanterns (#4897) * Implemented fortune for ores, glowstone and sea lanterns (but nothing organic or flint). * Cleanup printf * Stopped playing golf, gave the Camels a FirstHump and moved the FortuneDropMult comment. Thanks for the review :). * Got rid of FortuneDropMult and replaced with Peter's massive optimization/simplification. * Fixed default lapis max droprate (8 -> 9). * Clamp max drops for non-redstone ores to 10. * Comment justifying the clamp. --- src/Blocks/BlockGlowstone.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/Blocks/BlockGlowstone.h') diff --git a/src/Blocks/BlockGlowstone.h b/src/Blocks/BlockGlowstone.h index d43581a4d..930509e0a 100644 --- a/src/Blocks/BlockGlowstone.h +++ b/src/Blocks/BlockGlowstone.h @@ -6,7 +6,6 @@ - class cBlockGlowstoneHandler : public cBlockHandler { @@ -25,8 +24,10 @@ private: } else { - // TODO: Handle the Fortune enchantment here - return cItem(E_ITEM_GLOWSTONE_DUST, GetRandomProvider().RandInt(2, 4), 0); + 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); } } -- cgit v1.2.3