diff --git a/lua_api.html b/lua_api.html index c2c6302..e25ce5e 100644 --- a/lua_api.html +++ b/lua_api.html @@ -4,11 +4,10 @@ layout: default ---
Content and functionality can be added to Minetest 0.4 by using Lua scripting in run-time loaded mods.
@@ -407,12 +424,11 @@ things that is loaded by and interfaces with Minetest.Mods are contained and ran solely on the server side. Definitions and media files are automatically transferred to the client.
If you see a deficiency in the API, feel free to attempt to add the -functionality in the engine and API. You can send such improvements as -source code patches to celeron55@gmail.com.
+functionality in the engine and API.If you have any difficulty in understanding this, please read Programming in Lua.
#
, which are comments.
| | `-- modname_something_else.png
| |-- sounds
| |-- media
+| |-- locale
| `-- <custom data>
`-- another
@@ -553,6 +570,8 @@ time, if necessary. (See Settings
)
textures
, sounds
, media
Media files (textures, sounds, whatever) that will be transferred to the client and will be available for use by the mod.
+locale
Translation files for the clients. (See Translations
)
Registered names should generally be in this format:
`modname:<whatever>`
@@ -573,7 +592,7 @@ be used for overriding the registrations of some other mod.
when registering it.
(also that mod is required to have experimental
as a dependency)
The :
prefix can also be used for maintaining backwards compatibility.
-Aliases
+Aliases
Aliases can be added by using minetest.register_alias(name, convert_to)
or
minetest.register_alias_force(name, convert_to)
.
This will make Minetest to convert things called name to things called
@@ -588,6 +607,59 @@ you have an item called epiclylongmodname:stuff
, you could do
minetest.register_alias("stuff", "epiclylongmodname:stuff")
and be able to use /giveme stuff
.
+Mapgen aliases
+In a game, a certain number of these must be set to tell core mapgens which
+of the game's nodes are to be used by the core mapgens. For example:
+minetest.register_alias("mapgen_stone", "default:stone")
+
+Aliases needed for all mapgens except Mapgen v6
+Base terrain:
+"mapgen_stone"
+"mapgen_water_source"
+"mapgen_river_water_source"
+Caves:
+"mapgen_lava_source"
+Dungeons:
+Only needed for registered biomes where 'node_stone' is stone:
+"mapgen_cobble"
+"mapgen_stair_cobble"
+"mapgen_mossycobble"
+Only needed for registered biomes where 'node_stone' is desert stone:
+"mapgen_desert_stone"
+"mapgen_stair_desert_stone"
+Only needed for registered biomes where 'node_stone' is sandstone:
+"mapgen_sandstone"
+"mapgen_sandstonebrick"
+"mapgen_stair_sandstone_block"
+Aliases needed for Mapgen v6
+Terrain and biomes:
+"mapgen_stone"
+"mapgen_water_source"
+"mapgen_lava_source"
+"mapgen_dirt"
+"mapgen_dirt_with_grass"
+"mapgen_sand"
+"mapgen_gravel"
+"mapgen_desert_stone"
+"mapgen_desert_sand"
+"mapgen_dirt_with_snow"
+"mapgen_snowblock"
+"mapgen_snow"
+"mapgen_ice"
+Flora:
+"mapgen_tree"
+"mapgen_leaves"
+"mapgen_apple"
+"mapgen_jungletree"
+"mapgen_jungleleaves"
+"mapgen_junglegrass"
+"mapgen_pine_tree"
+"mapgen_pine_needles"
+Dungeons:
+"mapgen_cobble"
+"mapgen_stair_cobble"
+"mapgen_mossycobble"
+"mapgen_stair_desert_stone"
Textures
Mods should generally prefix their textures with modname_
, e.g. given
the mod name foomod
, a texture could be called:
@@ -623,12 +695,19 @@ is required for ^
and :
.
The lower 50 percent of color.png^[mask:trans.png
are overlaid
on top of cobble.png
.
Advanced texture modifiers
-[crack:<n>:<p>
+Crack
-- #
<n>
= animation frame count
-- #
<p>
= current animation frame
+- #
[crack:<n>:<p>
+- #
[cracko:<n>:<p>
+- #
[crack:<t>:<n>:<p>
+- #
[cracko:<t>:<n>:<p>
-Draw a step of the crack animation on the texture.
+Parameters:
+ <t>
= tile count (in each direction)
+ <n>
= animation frame count
+* <p>
= current animation frame
+Draw a step of the crack animation on the texture.
+crack
draws it normally, while cracko
lays it over, keeping transparent pixels intact.
Example:
default_cobble.png^[crack:10:1
@@ -714,7 +793,7 @@ Rotations are counter-clockwise.
[verticalframe:<t>:<n>
Crops the texture to a frame of a vertical animation.
Example:
@@ -832,7 +911,22 @@ lost on placement, because nodes on the map can only use palettes.
automatically transferred between node and item forms by the engine,
when a player digs or places a colored node.
You can disable this feature by setting the drop
field of the node
-to itself (without metadata).
+to itself (without metadata).
+To transfer the color to a special drop, you need a drop table.
+Example:
+minetest.register_node("mod:stone", {
+ description = "Stone",
+ tiles = {"default_stone.png"},
+ paramtype2 = "color",
+ palette = "palette.png",
+ drop = {
+ items = {
+ -- assume that mod:cobblestone also has the same palette
+ {items = {"mod:cobblestone"}, inherit_color = true },
+ }
+ }
+})
+
Colored items in craft recipes
Craft recipes only support item strings, but fortunately item strings
can also contain metadata. Example craft recipe registration:
@@ -859,7 +953,10 @@ are not merged in the memory, but they are simply drawn on top of each
other. This allows different hardware coloring, but also means that
tiles with overlays are drawn slower. Using too much overlays might
cause FPS loss.
-To define an overlay, simply set the overlay_tiles
field of the node
+
For inventory and wield images you can specify overlays which
+hardware coloring does not modify. You have to set inventory_overlay
+and wield_overlay
fields to an image name.
+To define a node overlay, simply set the overlay_tiles
field of the node
definition. These tiles are defined in the same way as plain tiles:
they can have a texture name, color etc.
To skip one face, set that overlay tile to an empty string.
@@ -991,6 +1088,13 @@ the global minetest.registered_*
tables.
- #if
biome.name
is nil, the key is the returned ID
minetest.unregister_biome(name)
name
from minetest.registered_biome
minetest.register_ore(ore definition)
Nodes can also contain extra data. See "Node Metadata".
@@ -1164,28 +1278,33 @@ paramtype2 == "glasslikeliquidlevel"firelike
fencelike
raillike
nodebox
-- See below. (Experimental!)mesh
-- use models for nodesplantlike_rooted
nodebox
-- See belowmesh
-- Use models for nodes, see belowplantlike_rooted
-- See below*_optional
drawtypes need less rendering time if deactivated (always client side).
Node selection boxes are defined using "node boxes"
-The nodebox
node drawtype allows defining visual of nodes consisting of
-arbitrary number of boxes. It allows defining stuff like stairs. Only the
-fixed
and leveled
box type is supported for these.
Please note that this is still experimental, and may be incompatibly -changed in the future.
+The nodebox
node drawtype allows defining nodes consisting of an arbitrary
+number of boxes. It allows defining stuff like stairs and slabs.
A nodebox is defined as any of:
{
-- A normal cube; the default in most things
type = "regular"
}
{
- -- A fixed box (facedir param2 is used, if applicable)
+ -- A fixed box (or boxes) (facedir param2 is used, if applicable)
type = "fixed",
fixed = box OR {box1, box2, ...}
}
+{
+ -- A variable height box (or boxes) with the top face position defined by
+ -- the node parameter 'leveled = ', or if 'paramtype2 == "leveled"' by
+ -- param2.
+ -- Other faces are defined by 'fixed = {}' as with 'type = "fixed"'.
+ type = "leveled",
+ fixed = box OR {box1, box2, ...}
+}
{
-- A box like the selection box for torches
-- (wallmounted param2 is used, if applicable)
@@ -1213,12 +1332,21 @@ changed in the future.
A box of a regular node would look like:
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
-type = "leveled"
is same as type = "fixed"
, but y2
will be automatically
-set to level from param2
.
Meshes
If drawtype mesh
is used, tiles should hold model materials textures.
Only static meshes are implemented.
For supported model formats see Irrlicht engine documentation.
+Rooted plantlike drawtype
+The plantlike_rooted
drawtype was developed to enable underwater plants
+without air bubbles around the plants.
+It consists of a base cube at the co-ordinates of the node (the seabed /
+lakebed / riverbed node) plus a 'plantlike' extension above with a height
+defined by param2 (maximum height 16 nodes). This extension visually passes
+through any nodes above the base cube without affecting them.
+The node is dug by digging the base cube.
+The base cube texture tiles are defined as normal, the plantlike extension
+uses the defined 'special tile', for example:
+special_tiles = { {name = "default_papyrus.png", tileable_vertical = true}},
Noise Parameters
Noise Parameters, or commonly called "NoiseParams
", define the properties of
perlin noise.
@@ -1307,13 +1435,15 @@ parameters np_puff_top
and np_puff_bottom
, respectivel
clust_scarcity
has the same meaning as with the scatter
type.
vein
Creates veins of ore varying in density by according to the intersection of two
-instances of 3d perlin noise with diffferent seeds, both described by
-noise_params
. random_factor
varies the influence random chance has on
-placement of an ore inside the vein, which is 1
by default. Note that
-modifying this parameter may require adjusting noise_threshold
.
-The parameters clust_scarcity
, clust_num_ores
, and clust_size
are ignored
-by this ore type. This ore type is difficult to control since it is sensitive
-to small changes. The following is a decent set of parameters to work from:
+instances of 3d perlin noise with different seeds, both described by
+noise_params
.
+random_factor
varies the influence random chance has on placement of an ore
+inside the vein, which is 1
by default. Note that modifying this parameter may
+require adjusting noise_threshold
.
+The parameters clust_scarcity
, clust_num_ores
, and clust_size
are ignored
+by this ore type.
+This ore type is difficult to control since it is sensitive to small changes.
+The following is a decent set of parameters to work from:
noise_params = {
offset = 0,
scale = 3,
@@ -1327,6 +1457,27 @@ noise_threshold = 1.6
WARNING: Use this ore type very sparingly since it is ~200x more
computationally expensive than any other ore.
+stratum
+Creates a single undulating ore stratum that is continuous across mapchunk
+borders and horizontally spans the world.
+The 2D perlin noise described by noise_params
defines the Y co-ordinate of the
+stratum midpoint. The 2D perlin noise described by np_stratum_thickness
+defines the stratum's vertical thickness (in units of nodes). Due to being
+continuous across mapchunk borders the stratum's vertical thickness is
+unlimited.
+If the noise parameter noise_params
is omitted the ore will occur from y_min
+to y_max in a simple horizontal stratum.
+A parameter stratum_thickness
can be provided instead of the noise parameter
+np_stratum_thickness
, to create a constant thickness.
+Leaving out one or both noise parameters makes the ore generation less intensive,
+useful when adding multiple strata.
+y_min
and y_max
define the limits of the ore generation and for performance
+reasons should be set as close together as possible but without clipping the
+stratum's Y variation.
+Each node in the stratum has a 1-in-clust_scarcity
chance of being ore, so a
+solid-ore stratum would require a clust_scarcity
of 1.
+The parameters clust_num_ores
, clust_size
, noise_threshold
and
+random_factor
are ignored by this ore type.
Ore attributes
See section "Flag Specifier Format".
Currently supported flags:
@@ -1361,11 +1512,11 @@ in the form of a table. This table specifies the following fields:
- #The
size
field is a 3D vector containing the dimensions of the provided schematic. (required)
- #The
yslice_prob
field is a table of {ypos, prob} which sets the ypos
th vertical slice
- of the schematic to have a prob / 256 * 100
chance of occuring. (default: 255)
+ of the schematic to have a prob / 256 * 100
chance of occurring. (default: 255)
data
field is a flat table of MapNode tables making up the schematic,
in the order of [z [y [x]]]
. (required)
Each MapNode table contains:name
: the name of the map node to place (required)name
: the name of the map node to place (required)prob
(alias param1
): the probability of this node being placed (default: 255)param2
: the raw param2 value of the node being placed onto the map (default: 0)force_place
: boolean representing if the node should forcibly overwrite any
@@ -1375,7 +1526,7 @@ in the form of a table. This table specifies the following fields:
0
or 1
means that node will never appear (0% chance).254
or 255
means the node will always appear (100% chance).p
is greater than 1
, then there is a
+p
is greater than 1
, then there is a
(p / 256 * 100)
percent chance that node will appear when the schematic is
placed on the map.waypoint
Displays distance to selected world position.
name
: The name of the waypoint.name
: The name of the waypoint.text
: Distance suffix. Can be blank.number:
An integer containing the RGB value of the color used to draw the text.world_pos
: World position of the waypoint.soil
: saplings will grow on nodes in this groupconnect_to_raillike
: makes nodes of raillike drawtype with same group value
connect to each otherslippery
: Players and items will slide on the node.
+ Slipperiness rises steadily with slippery
value, starting at 1.direction
is a unit vector, pointing from the source of the punch to
the punched object.damage
damage that will be done to entity
-Return value of this function will determin if damage is done by this function
+Return value of this function will determine if damage is done by this function
(retval true) or shall be done by engine (retval false)To punch an entity/object in Lua, call:
@@ -1992,7 +2145,7 @@ list[current_player;craftpreview;7,1;1,1;]w
and h
are the size of the fieldh
name
is the name of the field as returned in fields to on_receive_fields
name
is the name of the field as returned in fields to on_receive_fields
label
, if not blank, will be text printed on the top left above the fieldw
and h
are the size of the fieldh
name
is the name of the field as returned in fields to on_receive_fields
name
is the name of the field as returned in fields to on_receive_fields
label
, if not blank, will be text printed on the top left above the fielddefault
is the default value of the fielddefault
may contain variable references such as ${text}'
which
@@ -2034,6 +2187,8 @@ list[current_player;craftpreview;7,1;1,1;]
textarea[<X>,<Y>;<W>,<H>;<name>;<label>;<default>]
label[<X>,<Y>;<label>]
x
and y
position the itemlist relative to the top left of the menuw
and h
are the size of the itemlistname
fieldname sent to server on doubleclick value is current selected elementname
fieldname sent to server on doubleclick value is current selected elementlistelements
can be prepended by #color in hexadecimal format RRGGBB (only),x
and y
position the item list relative to the top left of the menuw
and h
are the size of the item listname
fieldname sent to server on doubleclick value is current selected elementname
fieldname sent to server on doubleclick value is current selected elementlistelements
can be prepended by #RRGGBB (only) in hexadecimal formatx
and y
position the itemlist relative to the top left of the menuname
fieldname data is transferred to Luaname
fieldname data is transferred to Luacaption 1
...: name shown on top of tabcurrent_tab
: index of selected tab 1...transparent
(optional): show transparentx
and y
: position of checkboxname
fieldname data is transferred to Luaname
fieldname data is transferred to Lualabel
to be shown left of checkboxselected
(optional): true
/false
tablecolumns[]
x
and y
: position the itemlist relative to the top left of the menuw
and h
are the size of the itemlistname
: fieldname sent to server on row select or doubleclickname
: fieldname sent to server on row select or doubleclickcell 1
...cell n
: cell contents given in row-major orderselected idx
: index of row to be selected within table (first row = 1
)minetest.explode_table_event
(main menu: engine.explode_table_event
)dump2(obj, name="_", dumped={})
dump2(obj, name, dumped)
: returns a string which makes obj
human readable,
+ handles reference loops
dump(obj, dumped={})
math.sign(x, tolerance)
0
when the absolute value is within the tolerance (default: 0
)math.sign(x, tolerance)
: returns -1
, 0
or 1
string.split(str, separator=",", include_empty=false, max_splits=-1, sep_is_pattern=false)
max_splits
is negative, do not limit splits.sep_is_pattern
specifies if separator is a plain string or a pattern (regex).string:split("a,b", ",") == {"a","b"}
string.split(str, separator, include_empty, max_splits, sep_is_pattern)
separator
: string, default: ","
include_empty
: boolean, default: false
max_splits
: number, if it's positive, splits aren't limited,
+ default: -1
sep_is_pattern
: boolean, it specifies whether separator is a plain
+ string or a pattern (regex), default: false
"a,b":split","
returns {"a","b"}
string:trim()
string.trim("\n \t\tfoo bar\t ") == "foo bar"
string:trim()
: returns the string whithout whitespace pre- and suffixes"\n \t\tfoo bar\t ":trim()
returns "foo bar"
minetest.wrap_text(str, limit)
: returns a stringminetest.wrap_text(str, limit, as_table)
: returns a string or tablelimit
: number, maximal amount of characters in one lineas_table
: boolean, if set to true, a table of lines instead of a string
+ is returned, default: false
minetest.pos_to_string({x=X,y=Y,z=Z}, decimal_places))
: returns string "(X,Y,Z)"
minetest.pos_to_string(pos, decimal_places)
: returns string "(X,Y,Z)"
minetest.string_to_pos(string)
: returns a positionnil
if the string can't be parsed to a position.minetest.string_to_pos(string)
: returns a position or nil
minetest.string_to_area("(X1, Y1, Z1) (X2, Y2, Z2)")
: returns two positionsTexts can be translated client-side with the help of minetest.translate
and translation files.
Two functions are provided to translate strings: minetest.translate
and minetest.get_translator
.
minetest.get_translator(textdomain)
is a simple wrapper around minetest.translate
, and
+ minetest.get_translator(textdomain)(str, ...)
is equivalent to minetest.translate(textdomain, str, ...)
.
+ It is intended to be used in the following way, so that it avoids verbose repetitions of minetest.translate
:
local S = minetest.get_translator(textdomain) +S(str, ...)
+As an extra commodity, if textdomain
is nil, it is assumed to be "" instead.
minetest.translate(textdomain, str, ...)
translates the string str
with the given textdomain
+ for disambiguation. The textdomain must match the textdomain specified in the translation file in order
+ to get the string translated. This can be used so that a string is translated differently in different contexts.
+ It is advised to use the name of the mod as textdomain whenever possible, to avoid clashes with other mods.
+ This function must be given a number of arguments equal to the number of arguments the translated string expects.
+ Arguments are literal strings -- they will not be translated, so if you want them to be, they need to come as
+ outputs of minetest.translate
as well.For instance, suppose we want to translate "@1 Wool" with "@1" being replaced by the translation of "Red". + We can do the following:
+local S = minetest.get_translator()
+S("@1 Wool", S("Red"))
+
+This will be displayed as "Red Wool" on old clients and on clients that do not have localization enabled.
+ However, if we have for instance a translation file named wool.fr.tr
containing the following:
@1 Wool=Laine @1
+Red=Rouge
+
+this will be displayed as "Laine Rouge" on clients with a French locale.
+The output of minetest.translate
is a string, with escape sequences adding additional information to that string
+so that it can be translated on the different clients. In particular, you can't expect operations like string.length
+to work on them like you would expect them to, or string.gsub to work in the expected manner. However, string
+concatenation will still work as expected (note that you should only use this for things like formspecs; do not
+translate sentences by breaking them into parts; arguments should be used instead), and operations such as
+minetest.colorize
which are only concatenation under the hood as well.
A translation file has the suffix .[lang].tr
, where [lang]
is the language it corresponds to.
+The file should be a text file, with the following format:
# textdomain:
(the space is significant) can be used to specify the text
+ domain of all following translations in the file.#
are ignored.original=translated
. Both original
and translated
can
+ contain escape sequences beginning with @
to insert arguments, literal @
, =
or newline
+ (See ### Escapes below). There must be no extraneous whitespace around the =
or at the beginning
+ or the end of the line.Strings that need to be translated can contain several escapes, preceded by @
.
+ @@
acts as a literal @
.
+ @n
, where n
is a digit between 1 and 9, is an argument for the translated string that will be inlined
+ when translation. Due to how translations are implemented, the original translation string must have
+ its arguments in increasing order, without gaps or repetitions, starting from 1.
+ @=
acts as a literal =
. It is not required in strings given to minetest.translate
, but is in translation
+ files to avoid begin confused with the =
separating the original from the translation.
+ @\n
(where the \n
is a literal newline) acts as a literal newline. As with @=
, this escape is not required
+ in strings given to minetest.translate
, but is in translation files.
+* @n
acts as a literal newline as well.
minetest
namespace referencearg
: string or table in format {foo=true, bar=true}
missing_features
: {foo=true, bar=true}
minetest.get_player_information(player_name)
:{
+- #Returns a table containing information about a player. Example return value:
{
address = "127.0.0.1", -- IP address of client
ip_version = 4, -- IPv4 / IPv6
min_rtt = 0.01, -- minimum round trip time
@@ -2462,7 +2699,7 @@ The following functions provide escape sequences:
max_jitter = 0.5, -- maximum packet time jitter
avg_jitter = 0.03, -- average packet time jitter
connection_uptime = 200, -- seconds since client connected
- prot_vers = 31, -- protocol version used by client
+ protocol_version = 32, -- protocol version used by client
-- following information is available on debug build only!!!
-- DO NOT USE IN MODS
--ser_vers = 26, -- serialization version used by client
@@ -2486,6 +2723,12 @@ The following functions provide escape sequences:
- false: return only file names.
minetest.safe_file_write(path, content)
: returns boolean indicating successlocal f = io.open(path, "wb"); f:write(content); f:close()
minetest.get_version()
: returns a table containing components of the
engine version. Components:project
: Name of the project, eg, "Minetest"if minetest.nodeupdate then ... end
.if minetest.check_for_falling then ... end
.minetest.sha1(data, [raw])
: returns the sha1 hash of data
minetest.register_tool(name, item definition)
minetest.register_craftitem(name, item definition)
minetest.unregister_item(name)
minetest.register_alias(name, convert_to)
minetest.register_alias(name, convert_to)
minetest.register_alias_force(name, convert_to)
minetest.register_craft(recipe)
minetest.register_on_placenode(func(pos, newnode, placer, oldnode, itemstack, pointed_thing))
@@ -2691,6 +2944,29 @@ The following functions provide escape sequences:
true
or itemstack
to cancel the default item eat response (i.e.: hp increase)minetest.register_on_priv_grant(function(name, granter, priv))
granter
grants the priv priv
to name
.minetest.register_on_priv_revoke(function(name, revoker, priv))
revoker
revokes the priv priv
from name
.minetest.register_can_bypass_userlimit(function(name, ip))
+minetest.register_on_modchannel_message(func(channel_name, sender, message))
sender
field is an empty string.definition
: { description = "description text", give_to_singleplayer = boolean}
the default of give_to_singleplayer
is truebasic_privs
to grant, see basic_privs
minetest.conf setting.on_grant(name, granter_name)
: Called when given to player name
by granter_name
.
+ granter_name
will be nil if the priv was granted by a mod.on_revoke(name, revoker_name)
: Called when taken from player name
by revoker_name
.
+ revoker_name
will be nil if the priv was revoked by a modminetest.register_authentication_handler(handler)
minetest.notify_authentication_modified(name)
minetest.check_password_entry(name, entry, password)
minetest.get_player_ip(name)
: returns an IP address stringminetest.set_player_password
, minetest_set_player_privs
, minetest_get_player_privs
-and minetest.auth_reload
call the authetification handler.
minetest.auth_reload
call the authentication handler.
minetest.chat_send_all(text)
minetest.auth_reload
call the authetification handler.
minetest.set_node(pos, node)
minetest.add_node(pos, node): alias set_node(pos, node)
node = {name="foo", param1=0, param2=0}
)minetest.add_node(pos, node): alias to
minetest.set_node`
minetest.swap_node(pos, node)
minetest.auth_reload
call the authetification handler.
minetest.remove_node(pos)
minetest.get_node(pos)
minetest.auth_reload
call the authetification handler.
pos
: The position where to measure the light.pos
: The position where to measure the light.timeofday
: nil
for current time, 0
for night, 0.5
for day0
and 15
or nil
minetest.auth_reload
call the authetification handler.
minetest.dig_node(pos)
minetest.punch_node(pos)
minetest.auth_reload
call the authetification handler.
minetest.get_player_by_name(name)
: Get an ObjectRef
to a playerminetest.get_objects_inside_radius(pos, radius)
minetest.get_mapgen_setting_noiseparams(name)
minetest.auth_reload
call the authetification handler.
minetest.set_mapgen_setting_noiseparams(name, value, [override_meta])
minetest.set_noiseparams(name, noiseparams, set_default)
name
to the noiseparams table specified in noiseparams
.name
to the noiseparams table specified in noiseparams
.set_default
is an optional boolean (default: true
) that specifies whether the setting
should be applied to the default config or current active configminetest.auth_reload
call the authetification handler.
minetest.spawn_tree (pos, {treedef})
minetest.transforming_liquid_add(pos)
minetest.auth_reload
call the authetification handler.
You can find mod channels communication scheme in docs/mod_channels.png
.
minetest.mod_channel_join(channel_name)
channel_name
, and creates it if necessary. You
+ should listen from incoming messages with minetest.register_on_modchannel_message
+ call to receive incoming messagesminetest.get_inventory(location)
: returns an InvRef
minetest.auth_reload
call the authetification handler.
minetest.dir_to_facedir(dir, is6d)
minetest.auth_reload
call the authetification handler.
minetest.is_colored_paramtype(ptype)
true
if the given paramtype2
contains color
+ information (color
, colorwallmounted
or colorfacedir
).minetest.strip_param2_color(param2, paramtype2)
+minetest.get_node_drops(nodename, toolname)
minetest.auth_reload
call the authetification handler.
minetest.item_place_node(itemstack, placer, pointed_thing, param2)
minetest.auth_reload
call the authetification handler.
on_rightclick
of pointed_thing.under
if defined insteadon_place
param2
overrides facedir
and wallmounted param2
param2
overrides facedir
and wallmounted param2
itemstack, success
minetest.auth_reload
call the authetification handler.
probability_list
.probability_list
is an array of tables containing two fields, pos
and prob
.pos
is the 3D vector specifying the absolute coordinates of the
+pos
is the 3D vector specifying the absolute coordinates of the
node being modified,prob
is an integer value from 0
to 255
that encodes probability and
per-node force-place. Probability has levels 0-127, then 128 is added to
@@ -3453,7 +3760,7 @@ and minetest.auth_reload
call the authetification handler.
0-127, then add 128 to apply per-node force-place.pos
is not inside the box formed by p1
and p2
, it is ignored.pos
is not inside the box formed by p1
and p2
, it is ignored.probability_list
equals nil
, no probabilities are applied.minetest.auth_reload
call the authetification handler.
minetest.place_schematic(pos, schematic, rotation, replacements, force_placement)
pos
.pos
.rotation
can equal "0"
, "90"
, "180"
, "270"
, or "random"
.rotation
parameter is omitted, the schematic is not rotated.replacements
= {["old_name"] = "convert_to", ...}
minetest.auth_reload
call the authetification handler.
minetest.player_exists(name)
: boolean, whether player exists (regardless of online status)minetest.hud_replace_builtin(name, hud_definition)
minetest.hash_node_position({x=,y=,z=})
: returns an 48-bit integerminetest.send_join_message(player_name)
minetest.send_leave_message(player_name, timed_out)
minetest.hash_node_position(pos)
: returns an 48-bit integerpos
: table {x=number, y=number, z=number},minetest.auth_reload
call the authetification handler.
minetest.get_content_id(name)
: returns an integer
minetest.get_name_from_content_id(content_id)
: returns a stringminetest.auth_reload
call the authetification handler.
minetest.is_protected(pos, name)
: returns boolean
name
shouldn't be abled to dig at pos
or do other
+name
shouldn't be abled to dig at pos
or do other
actions, defineable by mods, due to some mod-defined ownership-like concept.
Returns false or nil, if the player is allowed to do such actions.name
will be "" for non-players or unknown players.minetest.forceload_block(pos[, transient])
pos
.true
if area could be forceloadedpos
.true
if area could be forceloadedtransient
is false
or absent, the forceload will be persistent
(saved between server runs). If true
, the forceload will be transient
(not saved between server runs).minetest.forceload_free_block(pos[, transient])
An interface to use mod channels on client and server
+leave()
: leave the mod channel.channel_name
.is_writeable()
: returns true if channel is writeable and mod can send over it.send_all(message)
: Send message
though the mod channel.MetaDataRef
See StorageRef
, NodeMetaRef
and ItemStackMetaRef
.
set_string(name, value)
get_string(name)
from_table(nil or {})
equals(other)
NodeMetaRef
Node metadata: reference extra data and functionality stored in a node.
Can be obtained via minetest.get_meta(pos)
.
get_inventory()
: returns InvRef
minetest.get_meta(pos)
.
ItemStackMetaRef
ItemStack metadata: reference extra data and functionality stored in a stack.
Can be obtained via item:get_meta()
.
set_tool_capabilities([tool_capabilities])
StorageRef
Mod metadata: per mod metadata, saved automatically.
Can be obtained via minetest.get_mod_storage()
during load time.
NodeTimerRef
Node Timers: a high resolution persistent per-node timer.
Can be gotten via minetest.get_node_timer(pos)
.
set(timeout,elapsed)
minetest.get_node_timer(pos)
.
is_started()
: returns boolean state of timer
ObjectRef
Moving things in the game are generally these.
This is basically a reference to a C++ ServerActiveObject
remove()
: remove object (after returning from Lua)minetest.kick_player
insteadminetest.get_node_timer(pos)
.
set_wielded_item(item)
: replaces the wielded item, returns true
if successfulset_armor_groups({group1=rating, group2=rating, ...})
get_armor_groups()
: returns a table with the armor group ratingsset_animation({x=1,y=1}, frame_speed=15, frame_blend=0, frame_loop=true)
set_animation(frame_range, frame_speed, frame_blend, frame_loop)
frame_range
: table {x=num, y=num}, default: {x=1, y=1}
frame_speed
: number, default: 15.0
frame_blend
: number, default: 0.0
frame_loop
: boolean, default: true
get_animation()
: returns range
, frame_speed
, frame_blend
and frame_loop
set_animation_frame_speed(frame_speed)
frame_speed
: number, default: 15.0
set_attach(parent, bone, position, rotation)
get_attach()
: returns parent, bone, position, rotation or nil if it isn't attachedminetest.get_node_timer(pos)
.
set_velocity({x=num, y=num, z=num})
get_velocity()
: returns {x=num, y=num, z=num}
set_acceleration({x=num, y=num, z=num})
get_acceleration()
: returns {x=num, y=num, z=num}
set_velocity(vel)
vel
is a vector, e.g. {x=0.0, y=2.3, z=1.0}
get_velocity()
: returns the velocity, a vectorset_acceleration(acc)
acc
is a vectorget_acceleration()
: returns the acceleration, a vectorset_yaw(radians)
get_yaw()
: returns number in radiansset_texture_mod(mod)
get_texture_mod()
returns current texture modifierset_sprite(p={x=0,y=0}, num_frames=1, framelength=0.2,
- select_horiz_by_yawpitch=false)
set_sprite(p, num_frames, framelength, select_horiz_by_yawpitch)
p
: {x=number, y=number}, the coordinate of the first frame
+ (x: column, y: row), default: {x=0, y=0}
num_frames
: number, default: 1
framelength
: number, default: 0.2
select_horiz_by_yawpitch
: boolean, this was once used for the Dungeon
+ Master mob, default: false
get_entity_name()
(Deprecated: Will be removed in a future version)minetest.get_node_timer(pos)
.
get_breath()
: returns players breathset_breath(value)
: sets players breath
set_attribute(attribute, value)
:
minetest.get_node_timer(pos)
.
get_inventory_formspec()
: returns a formspec stringget_player_control()
: returns table with player pressed keys{jump=bool,right=bool,left=bool,LMB=bool,RMB=bool,sneak=bool,aux1=bool,down=bool,up=bool}
{jump=false, right=true, left=false, LMB=false, RMB=false,
+ sneak=true, aux1=false, down=false, up=false}
get_player_control_bits()
: returns integer with bit packed player pressed keysset_physics_override(override_table)
minetest.get_node_timer(pos)
.
hud_get(id)
: gets the HUD element definition structure of the specified IDhud_set_flags(flags)
: sets specified HUD flags to true
/false
flags
: (is visible) hotbar
, healthbar
, crosshair
, wielditem
, minimap
true
/false
value of each flag to be set or unsetflags
: (is visible) hotbar
, healthbar
, crosshair
, wielditem
, breathbar
,
+ minimap
, minimap_radar
true
/false
value of each flag to be set or unsetnil
, the flag is not modifiedminimap
modifies the client's permission to view the minimap -radar
is only usable when minimap
is truehud_get_flags()
: returns a table containing status of hud flags
hud_set_hotbar_itemcount(count)
: sets number of items in builtin hotbarminetest.get_node_timer(pos)
.
InvRef
An InvRef
is a reference to an inventory.
is_empty(listname)
: return true
if list is emptyget_size(listname)
: get size of a listdata
string attribute to store additional informat
You can create an empty AreaStore
by calling AreaStore()
, or AreaStore(type_name)
.
If you chose the parameter-less constructor, a fast implementation will be automatically
chosen for you.
-get_area(id, include_borders, include_data)
: returns the area with the id id
.
(optional) Boolean values include_borders
and include_data
control what's copied.
@@ -4220,16 +4584,22 @@ chosen for you.
An ItemStack
is a stack of items.
It can be created via ItemStack(x)
, where x is an ItemStack
,
an itemstring, a table or nil
.
is_empty()
: Returns true
if stack is empty.get_name()
: Returns item name (e.g. "default:stone"
).set_name(item_name)
: Returns boolean whether item was clearedis_empty()
: returns true
if stack is empty.get_name()
: returns item name (e.g. "default:stone"
).set_name(item_name)
: returns a boolean indicating whether the item was clearedget_count()
: Returns number of items on the stack.set_count(count)
: Returns boolean whether item was clearedget_wear()
: Returns tool wear (0
-65535
), 0
for non-tools.set_wear(wear)
: Returns boolean whether item was clearedget_meta()
: Returns ItemStackMetaRef. See section for more detailsset_count(count)
: returns a boolean indicating whether the item was clearedcount
: number, unsigned 16 bit integerget_wear()
: returns tool wear (0
-65535
), 0
for non-tools.set_wear(wear)
: returns boolean indicating whether item was clearedwear
: number, unsigned 16 bit integerget_meta()
: returns ItemStackMetaRef. See section for more detailsget_metadata()
: (DEPRECATED) Returns metadata (a string attached to an item stack).set_metadata(metadata)
: (DEPRECATED) Returns true.clear()
: removes all items from the stack, making it empty.nil
.
item
can also be an itemstring or table.to_string()
: Returns the stack in itemstring form.to_table()
: Returns the stack in Lua table form.get_stack_max()
: Returns the maximum size of the stack (depends on the item).get_free_space()
: Returns get_stack_max() - get_count()
.is_known()
: Returns true
if the item name refers to a defined item type.get_definition()
: Returns the item definition table.get_tool_capabilities()
: Returns the digging properties of the item,
- or those of the hand if none are defined for this item typeadd_wear(amount)
: Increases wear by amount
if the item is a tool.add_item(item)
: Put some item or stack onto this stack.
- Returns leftover ItemStack
.item_fits(item)
: Returns true
if item or stack can be fully added to
- this one.take_item(n=1)
: Take (and remove) up to n
items from this stack.
- Returns taken ItemStack
.peek_item(n=1)
: copy (don't remove) up to n
items from this stack.
- Returns taken ItemStack
.to_string()
: returns the stack in itemstring form.to_table()
: returns the stack in Lua table form.get_stack_max()
: returns the maximum size of the stack (depends on the item).get_free_space()
: returns get_stack_max() - get_count()
.is_known()
: returns true
if the item name refers to a defined item type.get_definition()
: returns the item definition table.get_tool_capabilities()
: returns the digging properties of the item,
+ or those of the hand if none are defined for this item typeadd_wear(amount)
+add_item(item)
: returns leftover ItemStack
item_fits(item)
: returns true
if item or stack can be fully added to
+ this one.take_item(n)
: returns taken ItemStack
+peek_item(n)
: returns taken ItemStack
+PseudoRandom
A 16-bit pseudorandom number generator. Uses a well-known LCG algorithm introduced by K&R.
It can be created via PseudoRandom(seed)
.
next()
: return next integer random number [0
...32767
]next(min, max)
: return next integer random number [min
...max
]A 32-bit pseudorandom number generator. Uses PCG32, an algorithm of the permuted congruential generator family, offering very strong randomness.
It can be created via PcgRandom(seed)
or PcgRandom(seed, sequence)
.
next()
: return next integer random number [-2147483648
...2147483647
]next(min, max)
: return next integer random number [min
...max
]Interface for the operating system's crypto-secure PRNG.
It can be created via SecureRandom()
. The constructor returns nil if a secure random device cannot be
be found on the system.
next_bytes([count])
: return next count
(default 1, capped at 2048) many random bytes, as a string.PerlinNoise(seed, octaves, persistence, scale)
PerlinNoise(noiseparams).
Alternatively with minetest.get_perlin(seeddiff, octaves, persistence, scale)
or minetest.get_perlin(noiseparams)
.
-get2d(pos)
: returns 2D noise value at pos={x=,y=}
get3d(pos)
: returns 3D noise value at pos={x=,y=,z=}
minetest.get_perlin(noiseparams)
.
A fast, bulk perlin noise generator.
It can be created via PerlinNoiseMap(noiseparams, size)
or
minetest.get_perlin_map(noiseparams, size)
.
Format of size
is {x=dimx, y=dimy, z=dimz}
. The z
conponent is ommitted
+
Format of size
is {x=dimx, y=dimy, z=dimz}
. The z
component is omitted
for 2D noise, and it must be must be larger than 1 for 3D noise (otherwise
nil
is returned).
For each of the functions with an optional buffer
parameter: If buffer
is not
nil, this table will be used to store the result instead of creating a new table.
get2dMap(pos)
: returns a <size.x>
times <size.y>
2D array of 2D noise
with values starting at pos={x=,y=}
read_from_map(p1, p2)
: Loads a chunk of map into the VoxelManip object containing
the region formed by p1
and p2
.A helper class for voxel areas.
It can be created via VoxelArea:new{MinEdge=pmin, MaxEdge=pmax}
.
The coordinates are inclusive, like most other things in Minetest.
getExtent()
: returns a 3D vector containing the size of the area formed by
MinEdge
and MaxEdge
Settings
An interface to read config files in the format of minetest.conf
.
It can be created via Settings(filename)
.
set_np_group(key, value)
value
is a NoiseParams table.remove(key)
: returns a boolean (true
for success)get_names()
: returns {key1,...}
write()
: returns a boolean (true
for success)pos2
: end of the ray
* objects
: if false, only nodes will be returned. Default is true.
* `liquids' : if false, liquid nodes won't be returned. Default is false.
-next()
: returns a pointed_thing
self
:
@@ -4662,8 +5050,10 @@ numeric unique decoration ID.
time_from_last_punch
: Meant for disallowing spamming of clicks (can be nil
)tool_capabilities
: capability table of used tool (can be nil
)dir
: unit vector of direction of punch. Always defined. Points from
- the puncher to the punched.
-on_death(self, killer)
on_death(self, killer)
killer
: an ObjectRef
(can be nil
){
hp_max = 1,
+-- ^ For players: Defaults to `minetest.PLAYER_MAX_HP_DEFAULT`
+ breath_max = 0,
+-- ^ For players only. Defaults to `minetest.PLAYER_MAX_BREATH_DEFAULT`
+ can_zoom = true,
+-- ^ For players only. Enables the zoom feature. Defaults to true
+ eye_height = 1.625,
+-- ^ For players only. Camera height above feet position in nodes. Defaults to 1.625
physical = true,
collide_with_objects = true, -- collide with other objects if physical = true
weight = 5,
collisionbox = {-0.5, 0.0, -0.5, 0.5, 1.0, 0.5},
+ selectionbox = {-0.5, 0.0, -0.5, 0.5, 1.0, 0.5},
+-- ^ Default, uses collision box dimensions when not set
+ pointable = true, -- overrides selection box when false
visual = "cube" / "sprite" / "upright_sprite" / "mesh" / "wielditem",
visual_size = {x = 1, y = 1},
mesh = "model",
@@ -4772,9 +5172,18 @@ minetest.spawn_tree(pos,apple_tree)
-- ^ Limit automatic rotation to this value in degrees per second,
-- value < 0 no limit.
backface_culling = true, -- false to disable backface_culling for model
+ glow = 0,
+-- ^ Add this much extra lighting when calculating texture color.
+-- Value < 0 disables light's effect on texture color.
+-- For faking self-lighting, UI style entities, or programmatic coloring in mods.
nametag = "", -- by default empty, for players their name is shown if empty
nametag_color = <color>, -- sets color of nametag as ColorSpec
infotext = "", -- by default empty, text to be shown when pointed at object
+ static_save = true,
+-- ^ If false, never save this object statically. It will simply be deleted when the
+-- block gets unloaded.
+-- The get_staticdata() callback is never called then.
+-- Defaults to 'true'
}
register_entity
)"image.png"
{name="image.png", animation={Tile Animation definition}}
{name="image.png", backface_culling=bool, tileable_vertical=bool,
- tileable_horizontal=bool}
{name="image.png", backface_culling=bool, tileable_vertical=bool,
+ tileable_horizontal=bool, align_style="node"/"world"/"user", scale=int}
glasslike_framed_optional
.
+ Note: supported by solid nodes and nodeboxes only.scale
) nodes,
+ instead of just one, in each direction. Works for world-aligned
+ textures only.
+ Note that as the effect is applied on per-mapblock basis, 16
should
+ be equally divisible by scale
or you may get wrong results.{name="image.png", color=ColorSpec}
register_ore
){
- ore_type = "scatter", -- See "Ore types"
+See 'Ore types' section above for essential information.
+
+{
+ ore_type = "scatter",
ore = "default:stone_with_coal",
+ ore_param2 = 3,
+-- ^ Facedir rotation. Default is 0 (unchanged rotation)
wherein = "default:stone",
-- ^ a list of nodenames is supported too
- clust_scarcity = 8*8*8,
+ clust_scarcity = 8 * 8 * 8,
-- ^ Ore has a 1 out of clust_scarcity chance of spawning in a node
--- ^ This value should be *MUCH* higher than your intuition might tell you!
+-- ^ If the desired average distance between ores is 'd', set this to d * d * d.
clust_num_ores = 8,
-- ^ Number of ores in a cluster
clust_size = 3,
-- ^ Size of the bounding box of the cluster
--- ^ In this example, there is a 3x3x3 cluster where 8 out of the 27 nodes are coal ore
+-- ^ In this example, there is a 3 * 3 * 3 cluster where 8 out of the 27 nodes
+-- ^ are coal ore.
y_min = -31000,
y_max = 64,
-- ^ Lower and upper limits for ore.
--- ^ Limits are relative to y = water_level - 1 for core mapgen, or
--- ^ relative to y = 0 for minetest.generate_ores().
flags = "",
--- ^ Attributes for this ore generation
+-- ^ Attributes for this ore generation, see 'Ore attributes' section above.
noise_threshold = 0.5,
--- ^ If noise is above this threshold, ore is placed. Not needed for a uniform distribution
- noise_params = {offset=0, scale=1, spread={x=100, y=100, z=100}, seed=23, octaves=3, persist=0.70}
--- ^ NoiseParams structure describing the perlin noise used for ore distribution.
--- ^ Needed for sheet ore_type. Omit from scatter ore_type for a uniform ore distribution
- random_factor = 1.0,
--- ^ Multiplier of the randomness contribution to the noise value at any
--- ^ given point to decide if ore should be placed. Set to 0 for solid veins.
--- ^ This parameter is only valid for ore_type == "vein".
+-- ^ If noise is above this threshold, ore is placed. Not needed for a
+-- ^ uniform distribution.
+ noise_params = {
+ offset = 0,
+ scale = 1,
+ spread = {x = 100, y = 100, z = 100},
+ seed = 23,
+ octaves = 3,
+ persist = 0.7
+ },
+-- ^ NoiseParams structure describing one of the perlin noises used for ore
+-- ^ distribution.
+-- ^ Needed by "sheet", "puff", "blob" and "vein" ores.
+-- ^ Omit from "scatter" ore for a uniform ore distribution.
+-- ^ Omit from "stratum ore for a simple horizontal strata from y_min to y_max.
biomes = {"desert", "rainforest"}
--- ^ List of biomes in which this decoration occurs. Occurs in all biomes if this is omitted,
--- ^ and ignored if the Mapgen being used does not support biomes.
+-- ^ List of biomes in which this decoration occurs.
+-- ^ Occurs in all biomes if this is omitted, and ignored if the Mapgen being
+-- ^ used does not support biomes.
-- ^ Can be a list of (or a single) biome names, IDs, or definitions.
+ column_height_min = 1,
+ column_height_max = 16,
+ column_midpoint_factor = 0.5,
+-- ^ See 'Ore types' section above.
+-- ^ The above 3 parameters are only valid for "sheet" ore.
+ np_puff_top = {
+ offset = 4,
+ scale = 2,
+ spread = {x = 100, y = 100, z = 100},
+ seed = 47,
+ octaves = 3,
+ persist = 0.7
+ },
+ np_puff_bottom = {
+ offset = 4,
+ scale = 2,
+ spread = {x = 100, y = 100, z = 100},
+ seed = 11,
+ octaves = 3,
+ persist = 0.7
+ },
+-- ^ See 'Ore types' section above.
+-- ^ The above 2 parameters are only valid for "puff" ore.
+ random_factor = 1.0,
+-- ^ See 'Ore types' section above.
+-- ^ Only valid for "vein" ore.
+ np_stratum_thickness = {
+ offset = 8,
+ scale = 4,
+ spread = {x = 100, y = 100, z = 100},
+ seed = 17,
+ octaves = 3,
+ persist = 0.7
+ },
+ stratum_thickness = 8,
+-- ^ See 'Ore types' section above.
+-- ^ The above 2 parameters are only valid for "stratum" ore.
}
Biome definition (register_biome
)
-Note
-The Biome API is still in an experimental phase and subject to change.
{
name = "tundra",
node_dust = "default:snow",
@@ -5273,14 +5752,6 @@ The Biome API is still in an experimental phase and subject to change.
y_min = 1,
y_max = 31000,
-- ^ Lower and upper limits for biome.
--- ^ Limits are relative to y = water_level - 1.
--- ^ Because biome is not recalculated for every node in a node column
--- ^ some biome materials can exceed their limits, especially stone.
--- ^ For each node column in a mapchunk, biome is only recalculated at column
--- ^ top and at each of these surfaces:
--- ^ Ground below air, water below air, ground below water.
--- ^ The selected biome then stays in effect for all nodes below until
--- ^ column base or the next biome recalculation.
heat_point = 0,
humidity_point = 50,
-- ^ Characteristic average temperature and humidity for the biome.
@@ -5292,7 +5763,7 @@ The Biome API is still in an experimental phase and subject to change.
-- ^ diagram to result in roughly equal size biomes.
-- ^ Heat and humidity have average values of 50, vary mostly between
-- ^ 0 and 100 but also often exceed these values.
--- ^ Heat is not in degrees celcius, both values are abstract.
+-- ^ Heat is not in degrees Celsius, both values are abstract.
}
Decoration definition (register_decoration
)
@@ -5316,36 +5787,54 @@ The Biome API is still in an experimental phase and subject to change.
y_min = -31000
y_max = 31000
-- ^ Lower and upper limits for decoration.
--- ^ Limits are relative to y = water_level - 1 for core mapgen, or
--- ^ relative to y = 0 for minetest.generate_decorations().
--- ^ This parameter refers to the `y` position of the decoration base, so
--- the actual maximum height would be `height_max + size.Y`.
+-- ^ These parameters refer to the Y co-ordinate of the 'place_on' node.
spawn_by = "default:water",
-- ^ Node (or list of nodes) that the decoration only spawns next to.
-- ^ Checks two horizontal planes of neighbouring nodes (including diagonal neighbours),
--- ^ one plane at Y = surface and one plane at Y = surface = + 1.
+-- ^ one plane level with the 'place_on' node and a plane one node above that.
num_spawn_by = 1,
-- ^ Number of spawn_by nodes that must be surrounding the decoration position to occur.
-- ^ If absent or -1, decorations occur next to any nodes.
- flags = "liquid_surface, force_placement",
+ flags = "liquid_surface, force_placement, all_floors, all_ceilings",
-- ^ Flags for all decoration types.
-- ^ "liquid_surface": Instead of placement on the highest solid surface
--- ^ in a mapchunk column, placement is on the highest liquid surface.
--- ^ Placement is disabled if solid nodes are found above the liquid surface.
--- ^ "force_placement": Nodes other than "air" and "ignore" are replaced by the decoration.
+-- ^ in a mapchunk column, placement is on the highest liquid surface.
+-- ^ Placement is disabled if solid nodes are found above the liquid
+-- ^ surface.
+-- ^ "force_placement": Nodes other than "air" and "ignore" are replaced
+-- ^ by the decoration.
+-- ^ "all_floors", "all_ceilings": Instead of placement on the highest
+-- ^ surface in a mapchunk the decoration is placed on all floor and/or
+-- ^ ceiling surfaces, for example in caves.
+-- ^ Ceiling decorations act as an inversion of floor decorations so the
+-- ^ effect of 'place_offset_y' is inverted.
+-- ^ If a single decoration registration has both flags the floor and
+-- ^ ceiling decorations will be aligned vertically and may sometimes
+-- ^ meet to form a column.
----- Simple-type parameters
decoration = "default:grass",
-- ^ The node name used as the decoration.
-- ^ If instead a list of strings, a randomly selected node from the list is placed as the decoration.
height = 1,
--- ^ Number of nodes high the decoration is made.
--- ^ If height_max is not 0, this is the lower bound of the randomly selected height.
+-- ^ Decoration height in nodes.
+-- ^ If height_max is not 0, this is the lower limit of a randomly selected height.
height_max = 0,
--- ^ Number of nodes the decoration can be at maximum.
+-- ^ Upper limit of the randomly selected height.
-- ^ If absent, the parameter 'height' is used as a constant.
param2 = 0,
--- ^ Param2 value of placed decoration node.
+-- ^ Param2 value of decoration nodes.
+-- ^ If param2_max is not 0, this is the lower limit of a randomly selected param2.
+ param2_max = 0,
+-- ^ Upper limit of the randomly selected param2.
+-- ^ If absent, the parameter 'param2' is used as a constant.
+ place_offset_y = 0,
+-- ^ Y offset of the decoration base node relative to the standard base
+-- ^ node position.
+-- ^ Can be positive or negative. Default is 0.
+-- ^ Effect is inverted for "all_ceilings" decorations.
+-- ^ Ignored by 'y_min', 'y_max' and 'spawn_by' checks, which always refer
+-- ^ to the 'place_on' node.
----- Schematic-type parameters
schematic = "foobar.mts",
@@ -5375,6 +5864,14 @@ The Biome API is still in an experimental phase and subject to change.
-- ^ Flags for schematic decorations. See 'Schematic attributes'.
rotation = "90" -- rotate schematic 90 degrees on placement
-- ^ Rotation can be "0", "90", "180", "270", or "random".
+ place_offset_y = 0,
+-- ^ If the flag 'place_center_y' is set this parameter is ignored.
+-- ^ Y offset of the schematic base node layer relative to the 'place_on'
+-- ^ node.
+-- ^ Can be positive or negative. Default is 0.
+-- ^ Effect is inverted for "all_ceilings" decorations.
+-- ^ Ignored by 'y_min', 'y_max' and 'spawn_by' checks, which always refer
+-- ^ to the 'place_on' node.
}
register_chatcommand
)