Eyes of ender now fly to End portal shrines!

This commit is contained in:
Wuzzy 2017-12-10 22:20:48 +01:00
parent 55778ab375
commit 664c24ce7d
6 changed files with 173 additions and 35 deletions

View file

@ -1,17 +0,0 @@
# Strongholds API
The API provides one function:
## `mcl_strongholds.get_stronghold_positions()`
Returns a table of the positions of all strongholds, centered at the end portal room.
This includes strongholds which have not been generated yet.
This table is a copy, changes to the table will have no effect on the stronghold generation.
Format of the returned table:
{
{ pos = <position>, generated = <true/false> }, -- first stronghold
{ pos = <position>, generated = <true/false> }, -- second stronghold
-- and so on …
}
* pos: Position of stronghold, centered at the end portal room
* generated: `true` if this stronghold has already been generated

View file

@ -59,6 +59,9 @@ local init_strongholds = function()
angle = math.fmod(angle + ((math.pi*2) / ring.amount), math.pi*2)
end
end
mcl_structures.register_structures("stronghold", table.copy(strongholds))
strongholds_inited = true
end
@ -90,13 +93,6 @@ local generate_strongholds = function(minp, maxp)
end
end
-- Minimal API
mcl_strongholds = {}
mcl_strongholds.get_stronghold_positions = function()
return table.copy(strongholds)
end
init_strongholds()
--[[ Note this mod depends on mcl_mapgen_core to make sure the core mapgen runs FIRST.

View file

@ -292,6 +292,28 @@ mcl_structures.generate_desert_temple = function(pos)
return ret
end
local registered_structures = {}
--[[ Returns a table of structure of the specified type.
Currently the only valid parameter is "stronghold".
Format of return value:
{
{ pos = <position>, generated=<true/false> }, -- first structure
{ pos = <position>, generated=<true/false> }, -- second structure
-- and so on
}
TODO: Implement this function for all other structure types as well.
]]
mcl_structures.get_registered_structures = function(structure_type)
return table.copy(registered_structures[structure_type])
end
-- Register a structures table for the given type. The table format is the same as for
-- mcl_structures.get_registered_structures.
mcl_structures.register_structures = function(structure_type, structures)
registered_structures[structure_type] = structures
end
-- Debug command
minetest.register_chatcommand("spawnstruct", {