summaryrefslogtreecommitdiffstats
path: root/source/Items/ItemPickaxe.h
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-09-29 15:59:32 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-09-29 15:59:32 +0200
commit4df23d19b7be2f274974e3dfe91e716e6296f11c (patch)
tree144451e77d8363c4c4d15c4f634c30bdf0728131 /source/Items/ItemPickaxe.h
parentExtended the cFile interface with Printf() (diff)
downloadcuberite-4df23d19b7be2f274974e3dfe91e716e6296f11c.tar
cuberite-4df23d19b7be2f274974e3dfe91e716e6296f11c.tar.gz
cuberite-4df23d19b7be2f274974e3dfe91e716e6296f11c.tar.bz2
cuberite-4df23d19b7be2f274974e3dfe91e716e6296f11c.tar.lz
cuberite-4df23d19b7be2f274974e3dfe91e716e6296f11c.tar.xz
cuberite-4df23d19b7be2f274974e3dfe91e716e6296f11c.tar.zst
cuberite-4df23d19b7be2f274974e3dfe91e716e6296f11c.zip
Diffstat (limited to 'source/Items/ItemPickaxe.h')
-rw-r--r--source/Items/ItemPickaxe.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/source/Items/ItemPickaxe.h b/source/Items/ItemPickaxe.h
new file mode 100644
index 000000000..158aca44f
--- /dev/null
+++ b/source/Items/ItemPickaxe.h
@@ -0,0 +1,75 @@
+
+#pragma once
+
+#include "ItemHandler.h"
+#include "../World.h"
+#include "../Player.h"
+
+class cItemPickaxeHandler : public cItemHandler
+{
+public:
+ cItemPickaxeHandler(int a_ItemID)
+ : cItemHandler(a_ItemID)
+ {
+
+ }
+
+ char PickaxeLevel()
+ {
+ switch(m_ItemID)
+ {
+ case E_ITEM_WOODEN_PICKAXE:
+ case E_ITEM_GOLD_PICKAXE:
+ return 1;
+ case E_ITEM_STONE_PICKAXE:
+ return 2;
+ case E_ITEM_IRON_PICKAXE:
+ return 3;
+ case E_ITEM_DIAMOND_PICKAXE:
+ return 4;
+ default:
+ return 0;
+ }
+ }
+
+ virtual bool CanHarvestBlock(BLOCKTYPE a_BlockID) override
+ {
+ switch(a_BlockID)
+ {
+ case E_BLOCK_OBSIDIAN:
+ return PickaxeLevel() >= 4;
+ case E_BLOCK_DIAMOND_BLOCK:
+ case E_BLOCK_DIAMOND_ORE:
+ case E_BLOCK_GOLD_BLOCK:
+ case E_BLOCK_GOLD_ORE:
+ case E_BLOCK_REDSTONE_ORE:
+ case E_BLOCK_REDSTONE_ORE_GLOWING:
+ case E_BLOCK_EMERALD_ORE:
+ return PickaxeLevel() >= 3;
+ case E_BLOCK_IRON_BLOCK:
+ case E_BLOCK_IRON_ORE:
+ case E_BLOCK_LAPIS_ORE:
+ case E_BLOCK_LAPIS_BLOCK:
+ return PickaxeLevel() >= 2;
+ case E_BLOCK_COAL_ORE:
+ case E_BLOCK_STONE:
+ case E_BLOCK_COBBLESTONE:
+ case E_BLOCK_END_STONE:
+ case E_BLOCK_MOSSY_COBBLESTONE:
+ case E_BLOCK_SANDSTONE_STAIRS:
+ case E_BLOCK_SANDSTONE:
+ case E_BLOCK_STONE_BRICKS:
+ case E_BLOCK_NETHER_BRICK:
+ case E_BLOCK_NETHERRACK:
+ case E_BLOCK_STONE_SLAB:
+ case E_BLOCK_DOUBLE_STONE_SLAB:
+ case E_BLOCK_STONE_PRESSURE_PLATE:
+ case E_BLOCK_BRICK:
+ case E_BLOCK_COBBLESTONE_STAIRS:
+ case E_BLOCK_STONE_BRICK_STAIRS:
+ case E_BLOCK_NETHER_BRICK_STAIRS:
+ return PickaxeLevel() >= 1;
+ }
+ return false;
+ }
+}; \ No newline at end of file