2013-07-29 07:13:03 -04:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ItemHandler.h"
|
|
|
|
#include "../World.h"
|
2013-08-19 05:39:13 -04:00
|
|
|
#include "../Entities/Player.h"
|
2013-07-29 07:13:03 -04:00
|
|
|
|
2017-08-06 15:57:44 -04:00
|
|
|
|
2014-02-02 09:49:37 -05:00
|
|
|
#include "../BlockInServerPluginInterface.h"
|
2013-07-29 07:13:03 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-13 12:38:06 -04:00
|
|
|
class cItemShovelHandler:
|
|
|
|
public cItemHandler
|
2013-07-29 07:13:03 -04:00
|
|
|
{
|
2020-04-13 12:38:06 -04:00
|
|
|
using Super = cItemHandler;
|
|
|
|
|
2013-07-29 07:13:03 -04:00
|
|
|
public:
|
2020-04-13 12:38:06 -04:00
|
|
|
|
|
|
|
cItemShovelHandler(int a_ItemType):
|
|
|
|
Super(a_ItemType)
|
2013-07-29 07:13:03 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
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-26 07:23:11 -04:00
|
|
|
if (a_BlockType == E_BLOCK_SNOW)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2020-04-13 12:38:06 -04:00
|
|
|
return Super::CanHarvestBlock(a_BlockType);
|
2013-07-29 07:13:03 -04:00
|
|
|
}
|
2014-04-30 18:47:57 -04:00
|
|
|
|
2019-10-16 04:06:34 -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_SHOVEL: return (a_ItemType == E_BLOCK_PLANKS);
|
|
|
|
case E_ITEM_STONE_SHOVEL: return (a_ItemType == E_BLOCK_COBBLESTONE);
|
|
|
|
case E_ITEM_IRON_SHOVEL: return (a_ItemType == E_ITEM_IRON);
|
|
|
|
case E_ITEM_GOLD_SHOVEL: return (a_ItemType == E_ITEM_GOLD);
|
|
|
|
case E_ITEM_DIAMOND_SHOVEL: return (a_ItemType == E_ITEM_DIAMOND);
|
2014-04-30 18:47:57 -04:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-10-16 04:06:34 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-11-13 10:21:30 -05:00
|
|
|
virtual float GetBlockBreakingStrength(BLOCKTYPE a_Block) override
|
2016-11-06 13:30:19 -05:00
|
|
|
{
|
|
|
|
switch (a_Block)
|
|
|
|
{
|
|
|
|
case E_BLOCK_CLAY:
|
2017-06-30 04:46:58 -04:00
|
|
|
case E_BLOCK_CONCRETE_POWDER:
|
2016-11-06 13:30:19 -05:00
|
|
|
case E_BLOCK_DIRT:
|
|
|
|
case E_BLOCK_FARMLAND:
|
|
|
|
case E_BLOCK_GRASS:
|
2017-02-14 05:13:55 -05:00
|
|
|
case E_BLOCK_GRASS_PATH:
|
2016-11-06 13:30:19 -05:00
|
|
|
case E_BLOCK_GRAVEL:
|
|
|
|
case E_BLOCK_MYCELIUM:
|
|
|
|
case E_BLOCK_SAND:
|
|
|
|
case E_BLOCK_SNOW:
|
|
|
|
case E_BLOCK_SNOW_BLOCK:
|
|
|
|
case E_BLOCK_SOULSAND:
|
|
|
|
{
|
|
|
|
switch (m_ItemType)
|
|
|
|
{
|
|
|
|
case E_ITEM_WOODEN_SHOVEL: return 2.0f;
|
|
|
|
case E_ITEM_STONE_SHOVEL: return 4.0f;
|
|
|
|
case E_ITEM_IRON_SHOVEL: return 6.0f;
|
|
|
|
case E_ITEM_GOLD_SHOVEL: return 12.0f;
|
|
|
|
case E_ITEM_DIAMOND_SHOVEL: return 8.0f;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2020-04-13 12:38:06 -04:00
|
|
|
return Super::GetBlockBreakingStrength(a_Block);
|
2016-11-06 13:30:19 -05:00
|
|
|
}
|
2014-02-02 09:49:37 -05:00
|
|
|
};
|