From 8f7554c95343b136795b1071548f9f012dfe808a Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sun, 22 Sep 2024 07:33:33 -0500 Subject: [PATCH] Stop wither from shooting itself --- mods/ENTITIES/mcl_mobs/init.lua | 2 ++ mods/ENTITIES/mobs_mc/wither.lua | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/mods/ENTITIES/mcl_mobs/init.lua b/mods/ENTITIES/mcl_mobs/init.lua index ea19acda9..f6b06b502 100644 --- a/mods/ENTITIES/mcl_mobs/init.lua +++ b/mods/ENTITIES/mcl_mobs/init.lua @@ -416,8 +416,10 @@ function mcl_mobs.register_arrow(name, def) ignore_gravity = true, damages_players = true, allow_punching = function(self, entity_def, projectile_def, object) + if def.allow_punching and not def.allow_punching(self, entity_def, projectile_def, object) then return false end if self.timer > 2 then return true end if self._owner and object == self._owner.object then return false end + return true end, on_collide_with_solid = function(self, pos, node, nodedef) diff --git a/mods/ENTITIES/mobs_mc/wither.lua b/mods/ENTITIES/mobs_mc/wither.lua index 0afb846b9..5f9fa32f1 100644 --- a/mods/ENTITIES/mobs_mc/wither.lua +++ b/mods/ENTITIES/mobs_mc/wither.lua @@ -466,6 +466,9 @@ mcl_mobs.register_arrow("mobs_mc:wither_skull", { rotate = 90, _lifetime = 15, on_punch = function(self) end, + allow_punching = function(self, _, _, object) + return object:get_luaentity().name ~= "mobs_mc:wither" + end, -- direct hit hit_player = function(self, player) @@ -519,6 +522,9 @@ mcl_mobs.register_arrow("mobs_mc:wither_skull_strong", { rotate = 90, _lifetime = 25, on_punch = function(self) end, + allow_punching = function(self, _, _, object) + return object:get_luaentity().name ~= "mobs_mc:wither" + end, -- direct hit hit_player = function(self, player)