summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockOre.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Blocks/BlockOre.h22
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:
{