From a3d798ca13c85f427c6529a65f5dc6049be44527 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 18 Sep 2018 20:08:03 +0200 Subject: [PATCH] Fix mobs playing damage sound when they healed --- mods/ENTITIES/mcl_mobs/api.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 846a86c27..cf72c7957 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -421,18 +421,22 @@ local check_for_death = function(self, cause, cmi_cause) return end + local damaged = self.health < self.old_health self.old_health = self.health - -- still got some health? play hurt sound + -- still got some health? if self.health > 0 then - mob_sound(self, self.sounds.damage) - -- make sure health isn't higher than max if self.health > self.hp_max then self.health = self.hp_max end + -- play damage sound if health was reduced + if damaged then + mob_sound(self, self.sounds.damage) + end + -- backup nametag so we can show health stats if not self.nametag2 then self.nametag2 = self.nametag or ""