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/BlockBigFlower.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/Blocks/BlockBigFlower.h') diff --git a/src/Blocks/BlockBigFlower.h b/src/Blocks/BlockBigFlower.h index 848cdce16..5df20dedf 100644 --- a/src/Blocks/BlockBigFlower.h +++ b/src/Blocks/BlockBigFlower.h @@ -65,15 +65,23 @@ private: auto flowerType = a_BlockMeta & 0x07; if (flowerType == E_META_BIG_FLOWER_DOUBLE_TALL_GRASS) { - if (GetRandomProvider().RandBool(1.0 / 24.0)) + + // Drop seeds, depending on bernoulli trial result: + if (GetRandomProvider().RandBool(0.875)) { - return cItem(E_ITEM_SEEDS); + // 87.5% chance of dropping nothing: + return {}; } + + // 12.5% chance of dropping some seeds. + const auto DropNum = FortuneDiscreteRandom(1, 1, 2 * ToolFortuneLevel(a_Tool)); + return cItem(E_ITEM_SEEDS, DropNum); } else if (flowerType != E_META_BIG_FLOWER_LARGE_FERN) { return cItem(m_BlockType, 1, static_cast(flowerType)); } + return {}; } -- cgit v1.2.3