From 7ce82b9dcbfe63337c3ccde221b91a6d424d7738 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Mon, 9 Oct 2023 00:57:13 +0200 Subject: [PATCH] Peaceful crash fixed --- mods/ENTITIES/mcl_wither_spawning/init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mods/ENTITIES/mcl_wither_spawning/init.lua b/mods/ENTITIES/mcl_wither_spawning/init.lua index 7d0746c5f..2a7a9c595 100644 --- a/mods/ENTITIES/mcl_wither_spawning/init.lua +++ b/mods/ENTITIES/mcl_wither_spawning/init.lua @@ -3,6 +3,7 @@ local dim = {"x", "z"} local modpath = minetest.get_modpath(minetest.get_current_modname()) local anti_troll = minetest.settings:get_bool("wither_anti_troll_measures", false) +local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false) local function load_schem(filename) local file = io.open(modpath .. "/schems/" .. filename, "r") @@ -54,6 +55,7 @@ local function check_limit(pos) end local function wither_spawn(pos, player) + if peaceful then return end for _, d in pairs(dim) do for i = 0, 2 do local p = vector.add(pos, {x = 0, y = -2, z = 0, [d] = -i}) @@ -61,6 +63,7 @@ local function wither_spawn(pos, player) if check_schem(p, schem) and (not anti_troll or check_limit(pos)) then remove_schem(p, schem) local wither = minetest.add_entity(vector.add(p, {x = 0, y = 1, z = 0, [d] = 1}), "mobs_mc:wither") + if not wither then return end local wither_ent = wither:get_luaentity() wither_ent._spawner = player:get_player_name() local dim = mcl_worlds.pos_to_dimension(pos)