diff --git a/mods/ENTITIES/mcl_mobs/api/api.lua b/mods/ENTITIES/mcl_mobs/api/api.lua index 756366bbe7..bafad36518 100644 --- a/mods/ENTITIES/mcl_mobs/api/api.lua +++ b/mods/ENTITIES/mcl_mobs/api/api.lua @@ -357,7 +357,7 @@ function mobs:register_mob(name, def) --do_punch = def.do_punch, - --on_punch = mob_punch, + on_punch = mobs.mob_punch, --on_breed = def.on_breed, diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/interaction.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/interaction.lua index b36051a382..17a48e931f 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/interaction.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/interaction.lua @@ -1,3 +1,5 @@ +local math_floor = math.floor + mobs.feed_tame = function(self) return nil end @@ -40,8 +42,16 @@ mobs.create_mob_on_rightclick = function(on_rightclick) end -- deal damage and effects when mob punched -local mob_punch = function(self, hitter, tflp, tool_capabilities, dir) +mobs.mob_punch = function(self, hitter, tflp, tool_capabilities, dir) + if self.neutral then + self.hostile = true + --hostile_cooldown timer is initialized here + self.hostile_cooldown_timer + end + + + --[[ -- custom punch function if self.do_punch then @@ -312,4 +322,5 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir) end end end + ]]-- end diff --git a/mods/ENTITIES/mobs_mc/zombiepig.lua b/mods/ENTITIES/mobs_mc/zombiepig.lua index efaf1b3967..4777cd7cb9 100644 --- a/mods/ENTITIES/mobs_mc/zombiepig.lua +++ b/mods/ENTITIES/mobs_mc/zombiepig.lua @@ -14,6 +14,8 @@ local pigman = { -- type="animal", passive=false: This combination is needed for a neutral mob which becomes hostile, if attacked type = "animal", passive = false, + neutral = true, + rotate = 270, spawn_class = "passive", hp_min = 20, hp_max = 20,