summaryrefslogtreecommitdiffstats
path: root/source/Blocks/BlockOre.h
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-10-01 23:08:15 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-10-01 23:08:15 +0200
commit85164fab8e5298ce1c0582b2aebb7e6a283d4a0c (patch)
tree6fdaf7f724044a025ecc9f1a8cadf8ee61d9355d /source/Blocks/BlockOre.h
parentAdded some missing block enums (diff)
downloadcuberite-85164fab8e5298ce1c0582b2aebb7e6a283d4a0c.tar
cuberite-85164fab8e5298ce1c0582b2aebb7e6a283d4a0c.tar.gz
cuberite-85164fab8e5298ce1c0582b2aebb7e6a283d4a0c.tar.bz2
cuberite-85164fab8e5298ce1c0582b2aebb7e6a283d4a0c.tar.lz
cuberite-85164fab8e5298ce1c0582b2aebb7e6a283d4a0c.tar.xz
cuberite-85164fab8e5298ce1c0582b2aebb7e6a283d4a0c.tar.zst
cuberite-85164fab8e5298ce1c0582b2aebb7e6a283d4a0c.zip
Diffstat (limited to '')
-rw-r--r--source/Blocks/BlockOre.h96
1 files changed, 59 insertions, 37 deletions
diff --git a/source/Blocks/BlockOre.h b/source/Blocks/BlockOre.h
index 556a215ce..86688b761 100644
--- a/source/Blocks/BlockOre.h
+++ b/source/Blocks/BlockOre.h
@@ -1,9 +1,16 @@
+
#pragma once
+
#include "BlockHandler.h"
#include "../MersenneTwister.h"
#include "../World.h"
-class cBlockOreHandler : public cBlockHandler
+
+
+
+
+class cBlockOreHandler :
+ public cBlockHandler
{
public:
cBlockOreHandler(BLOCKTYPE a_BlockID)
@@ -11,48 +18,63 @@ public:
{
}
- virtual char GetDropCount() override
+ virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
+ short ItemType = E_ITEM_EMPTY;
+ char Count = 1;
+ short Meta = 0;
+
MTRand r1;
- switch(m_BlockID)
+ switch (m_BlockID)
{
- case E_BLOCK_LAPIS_ORE:
- return 4 + (char)r1.randInt(4);
- case E_BLOCK_REDSTONE_ORE:
- case E_BLOCK_REDSTONE_ORE_GLOWING:
- return 4 + (char)r1.randInt(1);
- default:
- return 1;
+ case E_BLOCK_LAPIS_ORE:
+ {
+ ItemType = E_ITEM_DYE;
+ Count = 4 + (char)r1.randInt(4);
+ Meta = 4;
+ break;
+ }
+ case E_BLOCK_REDSTONE_ORE:
+ case E_BLOCK_REDSTONE_ORE_GLOWING:
+ {
+ Count = 4 + (char)r1.randInt(1);
+ break;
+ }
+ default:
+ {
+ Count = 1;
+ break;
+ }
}
- }
- virtual NIBBLETYPE GetDropMeta(NIBBLETYPE a_Meta) override
- {
- switch(m_BlockID)
+ switch (m_BlockID)
{
- case E_BLOCK_LAPIS_ORE:
- return 4;
- default:
- return 0;
+ case E_BLOCK_DIAMOND_ORE:
+ {
+ ItemType = E_ITEM_DIAMOND;
+ break;
+ }
+ case E_BLOCK_REDSTONE_ORE:
+ case E_BLOCK_REDSTONE_ORE_GLOWING:
+ {
+ ItemType = E_ITEM_REDSTONE_DUST;
+ break;
+ }
+ case E_BLOCK_EMERALD_ORE:
+ {
+ ItemType = E_ITEM_EMERALD;
+ break;
+ }
+ case E_BLOCK_COAL_ORE:
+ {
+ ItemType = E_ITEM_COAL;
+ break;
+ }
}
+ a_Pickups.push_back(cItem(ItemType, Count, Meta));
}
+} ;
+
+
+
- virtual int GetDropID() override
- {
- switch(m_BlockID)
- {
- case E_BLOCK_DIAMOND_ORE:
- return E_ITEM_DIAMOND;
- case E_BLOCK_REDSTONE_ORE:
- case E_BLOCK_REDSTONE_ORE_GLOWING:
- return E_ITEM_REDSTONE_DUST;
- case E_BLOCK_EMERALD_ORE:
- return E_ITEM_EMERALD;
- case E_BLOCK_LAPIS_ORE:
- return E_ITEM_DYE;
- case E_BLOCK_COAL_ORE:
- return E_ITEM_COAL;
- }
- return m_BlockID;
- }
-}; \ No newline at end of file