summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockGravel.h
diff options
context:
space:
mode:
authorKingCol13 <48412633+KingCol13@users.noreply.github.com>2020-09-28 14:41:49 +0200
committerGitHub <noreply@github.com>2020-09-28 14:41:49 +0200
commit8eca58a1c9d3ea928b301de1ad772a46164372e1 (patch)
tree9627cfb9c43ed9b332a493c474e7ebe119543b89 /src/Blocks/BlockGravel.h
parentEnchanting consumes lapis, removes correct number of levels (#4934) (diff)
downloadcuberite-8eca58a1c9d3ea928b301de1ad772a46164372e1.tar
cuberite-8eca58a1c9d3ea928b301de1ad772a46164372e1.tar.gz
cuberite-8eca58a1c9d3ea928b301de1ad772a46164372e1.tar.bz2
cuberite-8eca58a1c9d3ea928b301de1ad772a46164372e1.tar.lz
cuberite-8eca58a1c9d3ea928b301de1ad772a46164372e1.tar.xz
cuberite-8eca58a1c9d3ea928b301de1ad772a46164372e1.tar.zst
cuberite-8eca58a1c9d3ea928b301de1ad772a46164372e1.zip
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);
}