VoxeLibre/mods/CORE/mcl_worlds/API.md

84 lines
2.6 KiB
Markdown
Raw Permalink Normal View History

2021-03-28 07:40:36 +02:00
# mcl_worlds
This mod provides utility functions about positions and dimensions.
## mcl_worlds.is_in_void(pos)
This function returns:
* true, true: if pos is in deep void (deadly)
* true, false: if the pos is in void (non-deadly)
* false, false: otherwise
2021-03-28 07:40:36 +02:00
Params:
* pos: position
2021-11-10 05:54:28 +01:00
## mcl_worlds.y_to_layer(y)
This function is used to calculate the Minetest y layer and dimension of the given y Minecraft layer.
2021-03-28 07:40:36 +02:00
Mainly used for ore generation.
Takes a Y coordinate as input and returns:
* The corresponding Minecraft layer (can be `nil` if void)
* The corresponding Minecraft dimension ("overworld", "nether" or "end") or "void" if y is in the void
2021-03-28 07:40:36 +02:00
If the Y coordinate is not located in any dimension, it will return: nil, "void"
Params:
* y: int
## mcl_worlds.pos_to_dimension(pos)
This function return the Minecraft dimension of pos ("overworld", "nether" or "end") or "void" if y is in the void.
2021-03-28 07:40:36 +02:00
* pos: position
## mcl_worlds.layer_to_y(layer, mc_dimension)
2024-05-02 06:04:41 +02:00
Takes a Minecraft layer and a “dimension” name and returns the corresponding Y coordinate for VoxeLibre.
2021-03-28 07:40:36 +02:00
mc_dimension can be "overworld", "nether", "end" (default: "overworld").
* layer: int
* mc_dimension: string
## mcl_worlds.has_weather(pos)
Returns true if pos can have weather, false otherwise.
2021-03-28 07:40:36 +02:00
Weather can be only in the overworld.
* pos: position
## mcl_worlds.has_dust(pos)
Returns true if pos can have nether dust, false otherwise.
2021-03-28 07:40:36 +02:00
Nether dust can be only in the nether.
* pos: position
## mcl_worlds.compass_works(pos)
Returns true if compasses are working at pos, false otherwise.
In MC, you cant use compass in the nether and the end.
2021-03-28 07:40:36 +02:00
* pos: position
## mcl_worlds.compass_works(pos)
Returns true if clock are working at pos, false otherwise.
In MC, you cant use clock in the nether and the end.
2021-03-28 07:40:36 +02:00
* pos: position
2021-05-13 23:09:47 +02:00
## mcl_worlds.register_on_dimension_change(function(player, dimension, last_dimension))
2021-03-28 07:40:36 +02:00
Register a callback function func(player, dimension).
2021-03-28 07:40:36 +02:00
It will be called whenever a player changes between dimensions.
The void counts as dimension.
2021-05-13 23:09:47 +02:00
* player: player, the player who changed of dimension
* dimension: string, The new dimension of the player ("overworld", "nether", "end", "void").
* last_dimension: string, The dimension where the player was ("overworld", "nether", "end", "void").
2021-03-28 07:40:36 +02:00
## mcl_worlds.registered_on_dimension_change
Table containing all function registered with mcl_worlds.register_on_dimension_change()
## mcl_worlds.dimension_change(player, dimension)
Notify this mod of a dimension change of player to dimension
2021-03-28 07:40:36 +02:00
* player: player, player who changed the dimension
2021-11-10 05:54:28 +01:00
* dimension: string, new dimension ("overworld", "nether", "end", "void")