From ef384f7062ae10e6ec836a2de9f113b682ba575a Mon Sep 17 00:00:00 2001 From: cora Date: Mon, 12 Sep 2022 01:27:10 +0200 Subject: [PATCH] Make dragon spawn again, fix dragon fight --- mods/ENTITIES/mobs_mc/ender_dragon.lua | 4 ++-- mods/MAPGEN/mcl_structures/end_spawn.lua | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/ender_dragon.lua b/mods/ENTITIES/mobs_mc/ender_dragon.lua index e7a233fc53..af9f762fc4 100644 --- a/mods/ENTITIES/mobs_mc/ender_dragon.lua +++ b/mods/ENTITIES/mobs_mc/ender_dragon.lua @@ -96,10 +96,10 @@ mcl_mobs:register_mob("mobs_mc:enderdragon", { on_die = function(self, pos) if self._portal_pos then mcl_portals.spawn_gateway_portal() - mcl_structures.call_struct(self._portal_pos, "end_exit_portal_open") + mcl_structures.place_structure(self._portal_pos,mcl_structures.registered_structures["end_exit_portal_open"],PseudoRandom(minetest.get_mapgen_setting("seed")),math.random()) if self._initial then mcl_experience.throw_xp(pos, 11500) -- 500 + 11500 = 12000 - minetest.set_node(vector.add(self._portal_pos, vector.new(3, 5, 3)), {name = "mcl_end:dragon_egg"}) + minetest.set_node(vector.add(self._portal_pos, vector.new(0, 5, 0)), {name = "mcl_end:dragon_egg"}) end end end, diff --git a/mods/MAPGEN/mcl_structures/end_spawn.lua b/mods/MAPGEN/mcl_structures/end_spawn.lua index 1eeed6e395..a25300ef43 100644 --- a/mods/MAPGEN/mcl_structures/end_spawn.lua +++ b/mods/MAPGEN/mcl_structures/end_spawn.lua @@ -21,6 +21,14 @@ mcl_structures.register_structure("end_exit_portal",{ local p1 = vector.offset(pos,-5,-5,-5) local p2 = vector.offset(pos,5,5,5) minetest.bulk_set_node(minetest.find_nodes_in_area(p1,p2,{"mcl_portals:portal_end"}),{name="air"}) + local obj = minetest.add_entity(vector.offset(pos,3, 11, 3), "mobs_mc:enderdragon") + if obj then + 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 end }) mcl_structures.register_structure("end_exit_portal_open",{