1
0
Fork 0

Make mobs only drop XP orbs when they're killed by hit, attempt to fix Wuzzy/MineClone2#978

This commit is contained in:
kay27 2021-01-27 16:10:58 +04:00
parent 0c23406531
commit 7210dfcc1c
1 changed files with 4 additions and 6 deletions

View File

@ -789,18 +789,16 @@ local check_for_death = function(self, cause, cmi_cause)
local puncher = cmi_cause.puncher local puncher = cmi_cause.puncher
if puncher then if puncher then
wielditem = puncher:get_wielded_item() 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
end end
local cooked = mcl_burning.is_burning(self.object) or mcl_enchanting.has_enchantment(wielditem, "fire_aspect") local cooked = mcl_burning.is_burning(self.object) or mcl_enchanting.has_enchantment(wielditem, "fire_aspect")
local looting = mcl_enchanting.get_enchantment(wielditem, "looting") local looting = mcl_enchanting.get_enchantment(wielditem, "looting")
item_drop(self, cooked, looting) item_drop(self, cooked, looting)
end 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 end
-- execute custom death function -- execute custom death function