[mcl_mapgen_core] Don't crash if Ender Dragon doesn't spawn for some reason

This commit is contained in:
kay27 2021-05-10 01:57:34 +04:00
parent 31b56e77ee
commit 96be84161f
1 changed files with 8 additions and 3 deletions

View File

@ -1248,9 +1248,14 @@ local function generate_clay(minp, maxp, blockseed, voxelmanip_data, voxelmanip_
end end
local function generate_end_exit_portal(pos) local function generate_end_exit_portal(pos)
local dragon_entity = minetest.add_entity(vector.add(pos, vector.new(3, 11, 3)), "mobs_mc:enderdragon"):get_luaentity() local obj = minetest.add_entity(vector.add(pos, vector.new(3, 11, 3)), "mobs_mc:enderdragon")
dragon_entity._initial = true if obj then
dragon_entity._portal_pos = pos local dragon_entity = obj:get_luaentity()
dragon_entity._initial = true
dragon_entity._portal_pos = pos
else
minetest.log("error", "[mcl_mapgen_core] ERROR! Ender dragon doesn't want to spawn")
end
mcl_structures.call_struct(pos, "end_exit_portal") mcl_structures.call_struct(pos, "end_exit_portal")
end end