diff --git a/mods/ENTITIES/mobs_mc/enderman.lua b/mods/ENTITIES/mobs_mc/enderman.lua index 5445d59c43..600ed58b58 100644 --- a/mods/ENTITIES/mobs_mc/enderman.lua +++ b/mods/ENTITIES/mobs_mc/enderman.lua @@ -345,7 +345,8 @@ mcl_mobs:register_mob("mobs_mc:enderman", { end end else --if not attacking try to tp to the dark - if minetest.get_node_light(enderpos) > minetest.LIGHT_MAX then + local light = minetest.get_node_light(enderpos) + if light and light > minetest.LIGHT_MAX then self:teleport(nil) end end @@ -617,6 +618,7 @@ mcl_mobs:register_mob("mobs_mc:enderman", { }) minetest.register_on_leaveplayer(function(player) + if not spawners[player] then return end for _,s in pairs(spawners[player]) do minetest.delete_particlespawner(s) end