diff options
author | KingCol13 <48412633+KingCol13@users.noreply.github.com> | 2020-09-28 14:41:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-28 14:41:49 +0200 |
commit | 8eca58a1c9d3ea928b301de1ad772a46164372e1 (patch) | |
tree | 9627cfb9c43ed9b332a493c474e7ebe119543b89 /src/Blocks/BlockOre.h | |
parent | Enchanting consumes lapis, removes correct number of levels (#4934) (diff) | |
download | cuberite-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 'src/Blocks/BlockOre.h')
-rw-r--r-- | src/Blocks/BlockOre.h | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/Blocks/BlockOre.h b/src/Blocks/BlockOre.h index 98db5198d..95bffc75e 100644 --- a/src/Blocks/BlockOre.h +++ b/src/Blocks/BlockOre.h @@ -31,19 +31,23 @@ private: } } - auto & Random = GetRandomProvider(); const auto FortuneLevel = ToolFortuneLevel(a_Tool); - const auto Drops = std::max(static_cast<char>(1), FloorC<char>(Random.RandReal(FortuneLevel + 2.0))); + if ((m_BlockType == E_BLOCK_REDSTONE_ORE) || (m_BlockType == E_BLOCK_REDSTONE_ORE_GLOWING)) + { // Redstone follows the discrete random distribution, unlike other ores + const auto DropNum = FortuneDiscreteRandom(4, 5, FortuneLevel); + return cItem(E_ITEM_REDSTONE_DUST, DropNum); + } + + auto & Random = GetRandomProvider(); + const auto DropMult = std::max(static_cast<char>(1), FloorC<char>(Random.RandReal(FortuneLevel + 2.0))); switch (m_BlockType) { - case E_BLOCK_LAPIS_ORE: return cItem(E_ITEM_DYE, Drops * Random.RandInt<char>(4, 9), 4); - case E_BLOCK_REDSTONE_ORE: // Handled by next case (glowing redstone) - case E_BLOCK_REDSTONE_ORE_GLOWING: return cItem(E_ITEM_REDSTONE_DUST, Random.RandInt<char>(4, 5 + FortuneLevel)); - case E_BLOCK_DIAMOND_ORE: return cItem(E_ITEM_DIAMOND, Drops); - case E_BLOCK_EMERALD_ORE: return cItem(E_ITEM_EMERALD, Drops); - case E_BLOCK_COAL_ORE: return cItem(E_ITEM_COAL, Drops); - case E_BLOCK_NETHER_QUARTZ_ORE: return cItem(E_ITEM_NETHER_QUARTZ, Drops); + case E_BLOCK_LAPIS_ORE: return cItem(E_ITEM_DYE, DropMult * Random.RandInt<char>(4, 9), 4); + case E_BLOCK_DIAMOND_ORE: return cItem(E_ITEM_DIAMOND, DropMult); + case E_BLOCK_EMERALD_ORE: return cItem(E_ITEM_EMERALD, DropMult); + case E_BLOCK_COAL_ORE: return cItem(E_ITEM_COAL, DropMult); + case E_BLOCK_NETHER_QUARTZ_ORE: return cItem(E_ITEM_NETHER_QUARTZ, DropMult); case E_BLOCK_CLAY: return cItem(E_ITEM_CLAY, 4); default: { |