From 7210dfcc1c7a5c731fc5232be86b1d7020b53ae7 Mon Sep 17 00:00:00 2001 From: kay27 Date: Wed, 27 Jan 2021 16:10:58 +0400 Subject: [PATCH] Make mobs only drop XP orbs when they're killed by hit, attempt to fix https://git.minetest.land/Wuzzy/MineClone2/issues/978 --- mods/ENTITIES/mcl_mobs/api.lua | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 33e049a89..430c97166 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -789,18 +789,16 @@ local check_for_death = function(self, cause, cmi_cause) local puncher = cmi_cause.puncher if puncher then wielditem = puncher:get_wielded_item() + + if mod_experience and ((not self.child) or self.type ~= "animal") then + mcl_experience.throw_experience(self.object:get_pos(), math.random(self.xp_min, self.xp_max)) + end end end local cooked = mcl_burning.is_burning(self.object) or mcl_enchanting.has_enchantment(wielditem, "fire_aspect") local looting = mcl_enchanting.get_enchantment(wielditem, "looting") item_drop(self, cooked, looting) end - - local pos = self.object:get_pos() - - if mod_experience and ((not self.child) or self.type ~= "animal") then - mcl_experience.throw_experience(pos, math.random(self.xp_min, self.xp_max)) - end end -- execute custom death function