summaryrefslogtreecommitdiffstats
path: root/source/blocks/BlockOre.h
diff options
context:
space:
mode:
authorlapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-07-16 15:30:33 +0200
committerlapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-07-16 15:30:33 +0200
commitba70a151915bb14ddbe0527d8807508000819df6 (patch)
tree3d6d465e35067921809d3c5dc5c45d796934ad85 /source/blocks/BlockOre.h
parentA new Block handling system :o (diff)
downloadcuberite-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.h58
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