From 2553f681a0c17bd49ca1e44b4f0f817a0a18734f Mon Sep 17 00:00:00 2001 From: teknomunk Date: Tue, 18 Jun 2024 19:25:02 -0500 Subject: [PATCH] Implement doMobLoot gamerule --- mods/ENTITIES/mcl_mobs/physics.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/physics.lua b/mods/ENTITIES/mcl_mobs/physics.lua index 430eda24d..f19c7e854 100644 --- a/mods/ENTITIES/mcl_mobs/physics.lua +++ b/mods/ENTITIES/mcl_mobs/physics.lua @@ -8,6 +8,10 @@ local gamerule_maxEntityCramming = vl_tuning.setting("gamerule:maxEntityCramming description = S("The maximum number of pushable entities a mob or player can push, before taking 6♥♥♥ entity cramming damage per half-second."), default = 24, }) +local gamerule_doMobLoot = vl_tuning.setting("gamerule:doMobLoot", "bool", { + description = S("Whether mobs should drop items and experience orbs."), + default = true, +}) local CRAMMING_DAMAGE = 3 local DEATH_DELAY = 0.5 @@ -478,6 +482,8 @@ function mob_class:check_for_death(cause, cmi_cause) -- TODO other env damage shouldn't drop xp -- "rain", "water", "drowning", "suffocation" + if not gamerule_doMobLoot[1] then return end + -- dropped cooked item if mob died in fire or lava if cause == "lava" or cause == "fire" then self:item_drop(true, 0) @@ -507,13 +513,10 @@ function mob_class:check_for_death(cause, cmi_cause) end end end - - end -- execute custom death function if self.on_die then - local pos = self.object:get_pos() local on_die_exit = self.on_die(self, pos, cmi_cause) if on_die_exit ~= true then