diff options
author | Alexander Harkness <bearbin@gmail.com> | 2014-10-11 19:32:21 +0200 |
---|---|---|
committer | Alexander Harkness <bearbin@gmail.com> | 2014-10-11 19:32:21 +0200 |
commit | 93833069a80fe4aec33a95148df39ad40671ddaf (patch) | |
tree | 2e6a335a60e618b5fe456ca8a586a2c5448c8c87 /src/Blocks/BlockOre.h | |
parent | Reverted submodule changes. (diff) | |
parent | Merge pull request #1528 from kjanku1/master (diff) | |
download | cuberite-93833069a80fe4aec33a95148df39ad40671ddaf.tar cuberite-93833069a80fe4aec33a95148df39ad40671ddaf.tar.gz cuberite-93833069a80fe4aec33a95148df39ad40671ddaf.tar.bz2 cuberite-93833069a80fe4aec33a95148df39ad40671ddaf.tar.lz cuberite-93833069a80fe4aec33a95148df39ad40671ddaf.tar.xz cuberite-93833069a80fe4aec33a95148df39ad40671ddaf.tar.zst cuberite-93833069a80fe4aec33a95148df39ad40671ddaf.zip |
Diffstat (limited to 'src/Blocks/BlockOre.h')
-rw-r--r-- | src/Blocks/BlockOre.h | 39 |
1 files changed, 11 insertions, 28 deletions
diff --git a/src/Blocks/BlockOre.h b/src/Blocks/BlockOre.h index 9684dbb19..f6ea3aa3c 100644 --- a/src/Blocks/BlockOre.h +++ b/src/Blocks/BlockOre.h @@ -2,7 +2,6 @@ #pragma once #include "BlockHandler.h" -#include "../MersenneTwister.h" #include "../World.h" @@ -20,58 +19,42 @@ public: virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { - short ItemType = m_BlockType; - char Count = 1; - short Meta = 0; - - MTRand r1; + cFastRandom Random; + switch (m_BlockType) { case E_BLOCK_LAPIS_ORE: { - ItemType = E_ITEM_DYE; - Count = 4 + (char)r1.randInt(4); - Meta = 4; + a_Pickups.push_back(cItem(E_ITEM_DYE, (char)(4 + Random.NextInt(5)), 4)); break; } case E_BLOCK_REDSTONE_ORE: case E_BLOCK_REDSTONE_ORE_GLOWING: { - Count = 4 + (char)r1.randInt(1); - break; - } - default: - { - Count = 1; + a_Pickups.push_back(cItem(E_ITEM_REDSTONE_DUST, (char)(4 + Random.NextInt(2)), 0)); break; } - } - - switch (m_BlockType) - { case E_BLOCK_DIAMOND_ORE: { - ItemType = E_ITEM_DIAMOND; + a_Pickups.push_back(cItem(E_ITEM_DIAMOND)); break; } - case E_BLOCK_REDSTONE_ORE: - case E_BLOCK_REDSTONE_ORE_GLOWING: + case E_BLOCK_EMERALD_ORE: { - ItemType = E_ITEM_REDSTONE_DUST; + a_Pickups.push_back(cItem(E_ITEM_EMERALD)); break; } - case E_BLOCK_EMERALD_ORE: + case E_BLOCK_COAL_ORE: { - ItemType = E_ITEM_EMERALD; + a_Pickups.push_back(cItem(E_ITEM_COAL)); break; } - case E_BLOCK_COAL_ORE: + default: { - ItemType = E_ITEM_COAL; + a_Pickups.push_back(cItem(m_BlockType)); break; } } - a_Pickups.push_back(cItem(ItemType, Count, Meta)); } } ; |