From 107fb0b082aa647c49463d9b93e940581871f357 Mon Sep 17 00:00:00 2001 From: Eliy21 Date: Sat, 11 Nov 2023 16:20:06 +0000 Subject: [PATCH] Fix a bug that prevents continuous attacks on mobs when the attack key is held --- mods/ENTITIES/mcl_mobs/combat.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/combat.lua b/mods/ENTITIES/mcl_mobs/combat.lua index 66f477dbb..9c5b28062 100644 --- a/mods/ENTITIES/mcl_mobs/combat.lua +++ b/mods/ENTITIES/mcl_mobs/combat.lua @@ -603,6 +603,11 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir) end end + -- check for invulnerability + if tflp <= invul_time then + return + end + -- healing if damage <= -1 then self.health = self.health - math.floor(damage) @@ -638,7 +643,7 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir) if damage >= 0 then -- only play hit sound and show blood effects if damage is 1 or over; lower to 0.1 to ensure armor works appropriately. - if damage >= 0.1 and tflp > invul_time then + if damage >= 0.1 then -- weapon sounds if weapon:get_definition().sounds ~= nil then