diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 6c1a0567e..b284d8102 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -1029,6 +1029,14 @@ local node_ok = function(pos, fallback) return minetest.registered_nodes[fallback] end +local function get_light(pos) + if math.abs(pos.x) < 31000 and math.abs(pos.y) < 31000 and math.abs(pos.z) < 31000 then + local lightfunc = minetest.get_natural_light or minetest.get_node_light + return lightfunc(pos) + else + return 0 + end +end -- environmental damage (water, lava, fire, light etc.) local do_env_damage = function(self) @@ -1074,7 +1082,6 @@ local do_env_damage = function(self) -- Use get_node_light for Minetest version 5.3 where get_natural_light -- does not exist yet. - local get_light = minetest.get_natural_light or minetest.get_node_light local sunlight = get_light(pos, self.time_of_day) -- bright light harms mob