summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockGravel.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Blocks/BlockGravel.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/Blocks/BlockGravel.h b/src/Blocks/BlockGravel.h
index 972dea4e4..2e145f5e5 100644
--- a/src/Blocks/BlockGravel.h
+++ b/src/Blocks/BlockGravel.h
@@ -18,15 +18,19 @@ private:
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override
{
- // TODO: Handle the Fortune and Silk touch enchantments here
- if (GetRandomProvider().RandBool(0.10))
+ if (ToolHasSilkTouch(a_Tool))
{
- return cItem(E_ITEM_FLINT, 1, 0);
+ return cItem(E_BLOCK_GRAVEL);
}
- else
+
+ // Denominator of probability from wiki, don't let it go below 1.
+ const auto Denominator = std::max(10 - 3 * ToolFortuneLevel(a_Tool), 1);
+ if (GetRandomProvider().RandBool(1.0 / Denominator))
{
- return cItem(E_BLOCK_GRAVEL, 1, 0);
+ return cItem(E_ITEM_FLINT);
}
+
+ return cItem(E_BLOCK_GRAVEL);
}