From 8eca58a1c9d3ea928b301de1ad772a46164372e1 Mon Sep 17 00:00:00 2001 From: KingCol13 <48412633+KingCol13@users.noreply.github.com> Date: Mon, 28 Sep 2020 13:41:49 +0100 Subject: Fortune Drops (#4932) + Implemented and standardized all clamped discrete random drops. + Changed cItems Add from push_back to emplace_back. Implement fortune for crops. + Enabled hoes to be enchanted with efficiency, silk touch and fortune. Made leaves, gravel and crops affected by fortune. Co-authored-by: Tiger Wang --- src/Blocks/BlockHandler.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/Blocks/BlockHandler.h') diff --git a/src/Blocks/BlockHandler.h b/src/Blocks/BlockHandler.h index 55dbeb5ec..cc701ca8e 100644 --- a/src/Blocks/BlockHandler.h +++ b/src/Blocks/BlockHandler.h @@ -227,6 +227,15 @@ public: Can be used in ConvertToPickups() implementations. */ static unsigned char ToolFortuneLevel(const cItem * a_Tool); + /** Returns a random number of drops taking into account fortune. + Only applies to drops following clamped discrete random distribution. + a_DefaultMax is the maximum items from one block without fortune. + a_BonusMax is the amount to increase the max of randInt by, usually the fortune level (but not always) + a_DropCap is the maximum items from one block with fortune, + if unspecified set to 25 to prevent lag or crash with high level tools. + Similar to uniform_bonus_count at https://minecraft.gamepedia.com/Loot_table#Functions */ + static char FortuneDiscreteRandom(char a_MinDrop, char a_DefaultMax, unsigned char a_BonusMax, char a_DropCap = 25); + // Gets the blockhandler for the given block type. static const cBlockHandler & For(BLOCKTYPE a_BlockType); -- cgit v1.2.3