summaryrefslogtreecommitdiffstats
path: root/src/Entities/Player.cpp
diff options
context:
space:
mode:
authorJaume Aloy <hircine45@gmail.com>2014-08-31 11:28:42 +0200
committerJaume Aloy <hircine45@gmail.com>2014-08-31 11:28:42 +0200
commit6180f7df095c228530e4c0d2bfaa90fed7b11f49 (patch)
tree6fe80e11d9a381b944dea492759f45d46dddd3ec /src/Entities/Player.cpp
parentAdded a_Digger check (diff)
downloadcuberite-6180f7df095c228530e4c0d2bfaa90fed7b11f49.tar
cuberite-6180f7df095c228530e4c0d2bfaa90fed7b11f49.tar.gz
cuberite-6180f7df095c228530e4c0d2bfaa90fed7b11f49.tar.bz2
cuberite-6180f7df095c228530e4c0d2bfaa90fed7b11f49.tar.lz
cuberite-6180f7df095c228530e4c0d2bfaa90fed7b11f49.tar.xz
cuberite-6180f7df095c228530e4c0d2bfaa90fed7b11f49.tar.zst
cuberite-6180f7df095c228530e4c0d2bfaa90fed7b11f49.zip
Diffstat (limited to 'src/Entities/Player.cpp')
-rw-r--r--src/Entities/Player.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 8b829d090..338a87ac1 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -1963,6 +1963,8 @@ void cPlayer::UseEquippedItem(int a_Amount)
{
return;
}
+
+ // If the item has an unbreaking enchantment, give it a random chance of not breaking:
cItem Item = GetEquippedItem();
int UnbreakingLevel = Item.m_Enchantments.GetLevel(cEnchantments::enchUnbreaking);
if (UnbreakingLevel > 0)
@@ -1983,6 +1985,7 @@ void cPlayer::UseEquippedItem(int a_Amount)
return;
}
}
+
if (GetInventory().DamageEquippedItem(a_Amount))
{
m_World->BroadcastSoundEffect("random.break", GetPosX(), GetPosY(), GetPosZ(), 0.5f, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64));