2013-07-29 07:13:03 -04:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ItemHandler.h"
|
2017-08-06 15:57:44 -04:00
|
|
|
|
|
|
|
|
2013-07-29 07:13:03 -04:00
|
|
|
|
2013-08-19 05:39:13 -04:00
|
|
|
class cItemPickaxeHandler :
|
|
|
|
public cItemHandler
|
2013-07-29 07:13:03 -04:00
|
|
|
{
|
2014-07-26 07:23:11 -04:00
|
|
|
typedef cItemHandler super;
|
2013-07-29 07:13:03 -04:00
|
|
|
public:
|
|
|
|
cItemPickaxeHandler(int a_ItemType)
|
|
|
|
: cItemHandler(a_ItemType)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-01-05 06:28:06 -05:00
|
|
|
|
|
|
|
|
|
|
|
virtual short GetDurabilityLossByAction(eDurabilityLostAction a_Action) override
|
|
|
|
{
|
|
|
|
switch (a_Action)
|
|
|
|
{
|
|
|
|
case dlaAttackEntity: return 2;
|
|
|
|
case dlaBreakBlock: return 1;
|
|
|
|
case dlaBreakBlockInstant: return 0;
|
|
|
|
}
|
2018-02-04 18:07:12 -05:00
|
|
|
UNREACHABLE("Unsupported durability loss action");
|
2018-01-05 06:28:06 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-07-29 07:13:03 -04:00
|
|
|
char PickaxeLevel()
|
|
|
|
{
|
2014-07-21 09:19:48 -04:00
|
|
|
switch (m_ItemType)
|
2013-07-29 07:13:03 -04:00
|
|
|
{
|
2014-03-08 05:53:15 -05:00
|
|
|
case E_ITEM_WOODEN_PICKAXE: return 1;
|
|
|
|
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;
|
2013-07-29 07:13:03 -04:00
|
|
|
}
|
|
|
|
}
|
2016-02-05 16:45:45 -05:00
|
|
|
|
2013-07-29 07:13:03 -04:00
|
|
|
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override
|
|
|
|
{
|
2014-07-21 09:19:48 -04:00
|
|
|
switch (a_BlockType)
|
2013-07-29 07:13:03 -04:00
|
|
|
{
|
2013-08-19 05:39:13 -04:00
|
|
|
case E_BLOCK_OBSIDIAN:
|
|
|
|
{
|
|
|
|
return PickaxeLevel() >= 4;
|
|
|
|
}
|
2016-02-05 16:45:45 -05:00
|
|
|
|
2013-08-19 05:39:13 -04:00
|
|
|
case E_BLOCK_DIAMOND_BLOCK:
|
|
|
|
case E_BLOCK_DIAMOND_ORE:
|
2014-10-01 13:13:59 -04:00
|
|
|
case E_BLOCK_EMERALD_ORE:
|
2013-08-19 05:39:13 -04:00
|
|
|
case E_BLOCK_GOLD_BLOCK:
|
|
|
|
case E_BLOCK_GOLD_ORE:
|
|
|
|
case E_BLOCK_REDSTONE_ORE:
|
|
|
|
case E_BLOCK_REDSTONE_ORE_GLOWING:
|
|
|
|
{
|
|
|
|
return PickaxeLevel() >= 3;
|
|
|
|
}
|
2016-02-05 16:45:45 -05:00
|
|
|
|
2013-08-19 05:39:13 -04:00
|
|
|
case E_BLOCK_IRON_BLOCK:
|
|
|
|
case E_BLOCK_IRON_ORE:
|
|
|
|
case E_BLOCK_LAPIS_ORE:
|
|
|
|
case E_BLOCK_LAPIS_BLOCK:
|
|
|
|
{
|
|
|
|
return PickaxeLevel() >= 2;
|
|
|
|
}
|
2016-02-05 16:45:45 -05:00
|
|
|
|
2014-03-08 05:53:15 -05:00
|
|
|
case E_BLOCK_ANVIL:
|
2017-06-30 04:46:58 -04:00
|
|
|
case E_BLOCK_BLACK_GLAZED_TERRACOTTA:
|
2017-02-26 06:13:53 -05:00
|
|
|
case E_BLOCK_BLOCK_OF_COAL:
|
|
|
|
case E_BLOCK_BLOCK_OF_REDSTONE:
|
2017-06-30 04:46:58 -04:00
|
|
|
case E_BLOCK_BLUE_GLAZED_TERRACOTTA:
|
|
|
|
case E_BLOCK_BONE_BLOCK:
|
2017-02-26 06:13:53 -05:00
|
|
|
case E_BLOCK_BREWING_STAND:
|
2014-10-01 13:13:59 -04:00
|
|
|
case E_BLOCK_BRICK:
|
2017-02-26 06:13:53 -05:00
|
|
|
case E_BLOCK_BRICK_STAIRS:
|
2017-06-30 04:46:58 -04:00
|
|
|
case E_BLOCK_BROWN_GLAZED_TERRACOTTA:
|
2014-10-01 13:13:59 -04:00
|
|
|
case E_BLOCK_CAULDRON:
|
2013-08-19 05:39:13 -04:00
|
|
|
case E_BLOCK_COAL_ORE:
|
|
|
|
case E_BLOCK_COBBLESTONE:
|
2014-10-01 13:13:59 -04:00
|
|
|
case E_BLOCK_COBBLESTONE_STAIRS:
|
|
|
|
case E_BLOCK_COBBLESTONE_WALL:
|
2017-06-30 04:46:58 -04:00
|
|
|
case E_BLOCK_CONCRETE:
|
|
|
|
case E_BLOCK_CYAN_GLAZED_TERRACOTTA:
|
2017-02-26 06:13:53 -05:00
|
|
|
case E_BLOCK_DISPENSER:
|
|
|
|
case E_BLOCK_DROPPER:
|
2015-06-30 10:50:15 -04:00
|
|
|
case E_BLOCK_DOUBLE_RED_SANDSTONE_SLAB:
|
2014-10-01 13:13:59 -04:00
|
|
|
case E_BLOCK_DOUBLE_STONE_SLAB:
|
|
|
|
case E_BLOCK_ENCHANTMENT_TABLE:
|
2017-02-14 05:13:55 -05:00
|
|
|
case E_BLOCK_END_BRICKS:
|
2013-08-19 05:39:13 -04:00
|
|
|
case E_BLOCK_END_STONE:
|
2014-10-01 13:13:59 -04:00
|
|
|
case E_BLOCK_FURNACE:
|
2017-06-30 04:46:58 -04:00
|
|
|
case E_BLOCK_GRAY_GLAZED_TERRACOTTA:
|
|
|
|
case E_BLOCK_GREEN_GLAZED_TERRACOTTA:
|
2017-02-26 06:13:53 -05:00
|
|
|
case E_BLOCK_HARDENED_CLAY:
|
|
|
|
case E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE:
|
|
|
|
case E_BLOCK_HOPPER:
|
|
|
|
case E_BLOCK_IRON_BARS:
|
|
|
|
case E_BLOCK_IRON_DOOR:
|
|
|
|
case E_BLOCK_IRON_TRAPDOOR:
|
2017-06-30 04:46:58 -04:00
|
|
|
case E_BLOCK_LIGHT_BLUE_GLAZED_TERRACOTTA:
|
|
|
|
case E_BLOCK_LIGHT_GRAY_GLAZED_TERRACOTTA:
|
2017-02-26 06:13:53 -05:00
|
|
|
case E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE:
|
2014-10-01 13:13:59 -04:00
|
|
|
case E_BLOCK_LIT_FURNACE:
|
2017-06-30 04:46:58 -04:00
|
|
|
case E_BLOCK_LIME_GLAZED_TERRACOTTA:
|
|
|
|
case E_BLOCK_MAGENTA_GLAZED_TERRACOTTA:
|
2014-10-01 13:13:59 -04:00
|
|
|
case E_BLOCK_MOB_SPAWNER:
|
2013-08-19 05:39:13 -04:00
|
|
|
case E_BLOCK_MOSSY_COBBLESTONE:
|
2017-02-14 05:13:55 -05:00
|
|
|
case E_BLOCK_MAGMA:
|
2013-08-19 05:39:13 -04:00
|
|
|
case E_BLOCK_NETHER_BRICK:
|
2014-10-01 13:13:59 -04:00
|
|
|
case E_BLOCK_NETHER_BRICK_STAIRS:
|
2016-08-12 08:55:41 -04:00
|
|
|
case E_BLOCK_NETHER_BRICK_FENCE:
|
2017-02-26 06:13:53 -05:00
|
|
|
case E_BLOCK_NETHER_QUARTZ_ORE:
|
2013-08-19 05:39:13 -04:00
|
|
|
case E_BLOCK_NETHERRACK:
|
2017-02-14 05:13:55 -05:00
|
|
|
case E_BLOCK_OBSERVER:
|
2017-06-30 04:46:58 -04:00
|
|
|
case E_BLOCK_ORANGE_GLAZED_TERRACOTTA:
|
2014-10-01 13:13:59 -04:00
|
|
|
case E_BLOCK_PRISMARINE_BLOCK:
|
2017-06-30 04:46:58 -04:00
|
|
|
case E_BLOCK_PINK_GLAZED_TERRACOTTA:
|
|
|
|
case E_BLOCK_PURPLE_GLAZED_TERRACOTTA:
|
2017-02-14 05:13:55 -05:00
|
|
|
case E_BLOCK_PURPUR_BLOCK:
|
|
|
|
case E_BLOCK_PURPUR_DOUBLE_SLAB:
|
|
|
|
case E_BLOCK_PURPUR_PILLAR:
|
|
|
|
case E_BLOCK_PURPUR_SLAB:
|
|
|
|
case E_BLOCK_PURPUR_STAIRS:
|
2017-02-26 06:13:53 -05:00
|
|
|
case E_BLOCK_QUARTZ_BLOCK:
|
|
|
|
case E_BLOCK_QUARTZ_STAIRS:
|
2017-06-30 04:46:58 -04:00
|
|
|
case E_BLOCK_RED_GLAZED_TERRACOTTA:
|
2017-02-14 05:13:55 -05:00
|
|
|
case E_BLOCK_RED_NETHER_BRICK:
|
2014-10-01 13:13:59 -04:00
|
|
|
case E_BLOCK_RED_SANDSTONE:
|
|
|
|
case E_BLOCK_RED_SANDSTONE_STAIRS:
|
|
|
|
case E_BLOCK_SANDSTONE:
|
|
|
|
case E_BLOCK_SANDSTONE_STAIRS:
|
|
|
|
case E_BLOCK_STONE:
|
|
|
|
case E_BLOCK_STONE_BRICKS:
|
2013-08-19 05:39:13 -04:00
|
|
|
case E_BLOCK_STONE_BRICK_STAIRS:
|
2014-10-01 13:13:59 -04:00
|
|
|
case E_BLOCK_STONE_PRESSURE_PLATE:
|
|
|
|
case E_BLOCK_STONE_SLAB:
|
2017-06-30 04:46:58 -04:00
|
|
|
case E_BLOCK_WHITE_GLAZED_TERRACOTTA:
|
|
|
|
case E_BLOCK_YELLOW_GLAZED_TERRACOTTA:
|
2013-08-19 05:39:13 -04:00
|
|
|
{
|
|
|
|
return PickaxeLevel() >= 1;
|
|
|
|
}
|
2013-07-29 07:13:03 -04:00
|
|
|
}
|
2014-07-26 07:23:11 -04:00
|
|
|
return super::CanHarvestBlock(a_BlockType);
|
2013-07-29 07:13:03 -04:00
|
|
|
}
|
2014-04-30 18:47:57 -04:00
|
|
|
|
2014-05-06 13:38:09 -04:00
|
|
|
virtual bool CanRepairWithRawMaterial(short a_ItemType) override
|
2014-04-30 18:47:57 -04:00
|
|
|
{
|
|
|
|
switch (m_ItemType)
|
|
|
|
{
|
2014-05-06 13:38:09 -04:00
|
|
|
case E_ITEM_WOODEN_PICKAXE: return (a_ItemType == E_BLOCK_PLANKS);
|
|
|
|
case E_ITEM_STONE_PICKAXE: return (a_ItemType == E_BLOCK_COBBLESTONE);
|
|
|
|
case E_ITEM_IRON_PICKAXE: return (a_ItemType == E_ITEM_IRON);
|
|
|
|
case E_ITEM_GOLD_PICKAXE: return (a_ItemType == E_ITEM_GOLD);
|
|
|
|
case E_ITEM_DIAMOND_PICKAXE: return (a_ItemType == E_ITEM_DIAMOND);
|
2014-04-30 18:47:57 -04:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2016-11-06 13:30:19 -05:00
|
|
|
|
|
|
|
|
2016-11-13 10:21:30 -05:00
|
|
|
virtual float GetBlockBreakingStrength(BLOCKTYPE a_Block) override
|
2016-11-06 13:30:19 -05:00
|
|
|
{
|
|
|
|
if (!IsBlockMaterialIron(a_Block) && !IsBlockMaterialAnvil(a_Block) && !IsBlockMaterialRock(a_Block))
|
|
|
|
{
|
|
|
|
return super::GetBlockBreakingStrength(a_Block);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (m_ItemType)
|
|
|
|
{
|
|
|
|
case E_ITEM_WOODEN_PICKAXE: return 2.0f;
|
|
|
|
case E_ITEM_STONE_PICKAXE: return 4.0f;
|
|
|
|
case E_ITEM_IRON_PICKAXE: return 6.0f;
|
|
|
|
case E_ITEM_GOLD_PICKAXE: return 12.0f;
|
|
|
|
case E_ITEM_DIAMOND_PICKAXE: return 8.0f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ASSERT(!"Something is wrong here... Maybe they are pickaxes out of a new material?");
|
|
|
|
return 1.0f;
|
|
|
|
}
|
|
|
|
|
2013-08-19 05:39:13 -04:00
|
|
|
} ;
|