Make dragon spawn again, fix dragon fight

This commit is contained in:
cora 2022-09-12 01:27:10 +02:00
parent ce9862d55e
commit 98858f70d0
2 changed files with 10 additions and 2 deletions

View file

@ -96,10 +96,10 @@ mcl_mobs:register_mob("mobs_mc:enderdragon", {
on_die = function(self, pos) on_die = function(self, pos)
if self._portal_pos then if self._portal_pos then
mcl_portals.spawn_gateway_portal() 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 if self._initial then
mcl_experience.throw_xp(pos, 11500) -- 500 + 11500 = 12000 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 end
end, end,

View file

@ -21,6 +21,14 @@ mcl_structures.register_structure("end_exit_portal",{
local p1 = vector.offset(pos,-5,-5,-5) local p1 = vector.offset(pos,-5,-5,-5)
local p2 = 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"}) 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 end
}) })
mcl_structures.register_structure("end_exit_portal_open",{ mcl_structures.register_structure("end_exit_portal_open",{