summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Items/ItemHandler.cpp17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp
index e10f17db1..976ab959d 100644
--- a/src/Items/ItemHandler.cpp
+++ b/src/Items/ItemHandler.cpp
@@ -494,10 +494,8 @@ void cItemHandler::OnBlockDestroyed(cWorld * a_World, cPlayer * a_Player, const
Handler->DropBlock(ChunkInterface, *a_World, PluginInterface, a_Player, a_BlockX, a_BlockY, a_BlockZ, CanHarvestBlock(Block));
}
- if (!cBlockInfo::IsOneHitDig(Block))
- {
- a_Player->UseEquippedItem(GetDurabilityLossByAction(dlaBreakBlock));
- }
+ auto Action = (cBlockInfo::IsOneHitDig(Block) ? dlaBreakBlockInstant : dlaBreakBlock);
+ a_Player->UseEquippedItem(Action);
}
@@ -507,7 +505,7 @@ void cItemHandler::OnBlockDestroyed(cWorld * a_World, cPlayer * a_Player, const
void cItemHandler::OnEntityAttack(cPlayer * a_Attacker, cEntity * a_AttackedEntity)
{
UNUSED(a_AttackedEntity);
- a_Attacker->UseEquippedItem(GetDurabilityLossByAction(dlaAttackEntity));
+ a_Attacker->UseEquippedItem(dlaAttackEntity);
}
@@ -527,15 +525,9 @@ void cItemHandler::OnFoodEaten(cWorld * a_World, cPlayer * a_Player, cItem * a_I
short cItemHandler::GetDurabilityLossByAction(eDurabilityLostAction a_Action)
{
- switch (a_Action)
- {
- case dlaAttackEntity: return 2;
- case dlaBreakBlock: return 1;
- }
+ UNUSED(a_Action);
- #ifndef __clang__
return 0;
- #endif
}
@@ -865,4 +857,3 @@ float cItemHandler::GetBlockBreakingStrength(BLOCKTYPE a_Block)
{
return 1.0f;
}
-