From 1f05d8f876108986c7d8d9ac7e0241983115afa0 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 11 Jan 2021 16:38:05 +0100 Subject: [PATCH] Knockback enchantment working on mobs --- mods/ENTITIES/mcl_mobs/api.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 29602e740a..7fee798bc6 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -3077,6 +3077,18 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir) kb = kb * 1.5 end + + local luaentity + if hitter then + luaentity = hitter:get_luaentity() + end + if hitter and hitter:is_player() then + local wielditem = hitter:get_wielded_item() + kb = kb + 3 * mcl_enchanting.get_enchantment(wielditem, "knockback") + elseif luaentity and luaentity._knockback then + kb = kb + luaentity._knockback + end + self.object:set_velocity({ x = dir.x * kb, y = dir.y * kb + up,