4.7 KiB
API for mcl_stairs
Register your own stairs and slabs!
Quick start
Register platinum stair and slab based on node example:platinum
:
mcl_stairs.register_stair_and_slab_simple("platinum", "example:platinum", "Platinum Stair", "Platinum Slab", "Double Platinum Slab")
mcl_stairs.register_stair_and_slab_simple(name, sourcenode, desc_stair, desc_slab, double_description, corner_stair_texture_override)
Register a simple stair and a slab. The stair and slab will inherit all attributes from sourcenode
. The sourcenode
is also used as the item for crafting recipes.
This function is meant for simple nodes; if you need more flexibility, use one of the other functions instead.
See register_stair
and register_slab
for the itemstrings of the registered nodes.
Parameters
name
: Name for node itemstrings (seeregister_stair
andregister_slab
)sourcenode
: The node on which this stair is based ondesc_stair
: Description of stair nodedesc_slab
: Description of slab nodedouble_description
: Description of double slab nodecorner_stair_texture_override
: Optional, seeregister_stair
mcl_stairs.register_stair_and_slab(name, recipeitem, groups, images, desc_stair, desc_slab, sounds, hardness, double_description, corner_stair_texture_override)
Register a simple stair and a slab, plus crafting recipes. In this function, you need to specify most things explicitly.
Parameters
desc_stair
: Description of stair nodedesc_slab
: Description of slab node- Other parameters: Same as for
register_stair
andregister_slab
mcl_stairs.register_stair(name, recipeitem, groups, images, description, sounds, hardness, corner_stair_texture_override)
Registers a stair. This also includes the inner and outer corner stairs, they are added automatically. Also adds crafting recipes.
If name
contains no colon, the itemstrings for the registered nodes will be of the form:
mcl_stairs:stair_<name>
: Normal stairmcl_stairs:stair_<name>_inner
: Inner stairmcl_stairs:stair_<name>_outer
: Outer stair
If name
contains a colon, the string is split at the colon into modname
and subname
.
The itemstrings for the registered nodes will be of the form:
<modname>:stair_<subname>
: Normal stair<modname>:stair_<subname>_inner
: Inner stair<modname>:stair_<subname>_outer
: Outer stair
In the latter case, item aliases are registered for stairs registered using the colon-less form.
Parameters
name
: Name fragment for node itemstrings (see above)recipeitem
: Item for crafting recipe. Usegroup:
prefix to use a group insteadgroups
: Groups used for stairimages
: Texturesdescription
: Stair description/tooltipsounds
: Sounds tablehardness
: MCL2 block hardness valuecorner_stair_texture_override
: Optional. Custom textures for corner stairs, see below
groups
, images
, sounds
or hardness
can be nil
, in which case the value is inhereted from the recipeitem
.
corner_stair_texture_override
This optional parameter specifies the textures to be used for corner stairs.
It can be one of the following data types:
- string: one of:
- "default": Use same textures as original node
- "woodlike": Take first frame of the original tiles, then take a triangle piece of the texture, rotate it by 90° and overlay it over the original texture
- table: Specify textures explicitly. Table of tiles to override textures for inner and outer stairs. Table format: { tiles_def_for_outer_stair, tiles_def_for_inner_stair }
- nil: Equivalent to "default"
mcl_stairs.register_slab(name, recipeitem, groups, images, description, sounds, hardness, double_description)
Registers a slab and a corresponding double slab. Also adds crafting recipe.
The itemstrings for the registered nodes will be of the form:
mcl_stairs:slab_<name>
: Slabmcl_stairs:slab_<name>_top
: Upper slab, used internallymcl_stairs:slab_<name>_double
: Double slab
If name
contains no colon, the itemstrings for the registered nodes will be of the form:
mcl_stairs:slab_<name>
: Normal stairmcl_stairs:slab_<name>_top
: Inner stairmcl_stairs:slab_<name>_double
: Outer stair
If name
contains a colon, the string is split at the colon into modname
and subname
.
The itemstrings for the registered nodes will be of the form:
<modname>:slab_<subname>
: Normal stair<modname>:slab_<subname>_top
: Inner stair<modname>:slab_<subname>_double
: Outer stair
In the latter case, item aliases are registered for slabs registered using the colon-less form.
Parameters
double_description
: Node description/tooltip for double slab- Other parameters: Same as for
register_stair