diff options
author | lapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-07-16 15:30:33 +0200 |
---|---|---|
committer | lapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-07-16 15:30:33 +0200 |
commit | ba70a151915bb14ddbe0527d8807508000819df6 (patch) | |
tree | 3d6d465e35067921809d3c5dc5c45d796934ad85 /source/blocks/BlockOre.h | |
parent | A new Block handling system :o (diff) | |
download | cuberite-ba70a151915bb14ddbe0527d8807508000819df6.tar cuberite-ba70a151915bb14ddbe0527d8807508000819df6.tar.gz cuberite-ba70a151915bb14ddbe0527d8807508000819df6.tar.bz2 cuberite-ba70a151915bb14ddbe0527d8807508000819df6.tar.lz cuberite-ba70a151915bb14ddbe0527d8807508000819df6.tar.xz cuberite-ba70a151915bb14ddbe0527d8807508000819df6.tar.zst cuberite-ba70a151915bb14ddbe0527d8807508000819df6.zip |
Diffstat (limited to '')
-rw-r--r-- | source/blocks/BlockOre.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/source/blocks/BlockOre.h b/source/blocks/BlockOre.h new file mode 100644 index 000000000..d1714f1af --- /dev/null +++ b/source/blocks/BlockOre.h @@ -0,0 +1,58 @@ +#pragma once
+#include "Block.h"
+#include "../MersenneTwister.h"
+#include "../cWorld.h"
+
+class cBlockOreHandler : public cBlockHandler
+{
+public:
+ cBlockOreHandler(BLOCKTYPE a_BlockID)
+ : cBlockHandler(a_BlockID)
+ {
+ }
+
+ virtual char GetDropCount() override
+ {
+ MTRand r1;
+ 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;
+ }
+ }
+
+ virtual char GetDropMeta(char a_Meta) override
+ {
+ switch(m_BlockID)
+ {
+ case E_BLOCK_LAPIS_ORE:
+ return 4;
+ default:
+ return 0;
+ }
+ }
+
+ 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 |