minetest.register_alias

From Minetest Developer Wiki
Jump to: navigation, search

Contents

Syntax

minetest.register_alias("name", "convert_to")

Description

name is converted to convert_to by the engine. This means that if the engine finds nodes with the name name in the world the node with the name convert_to is used instead.

This is useful to maintain backwards compatibility.

There are also other cases like map generation where aliases are used. The /giveme command also looks for aliases when adding the item to the players inventory.

Example 1

The map generator of the engine uses some nodenames for the output that are not registered. The default game registers aliases so the engine knows wich nodes to place there:

minetest.register_alias("mapgen_stone", "default:stone")

Example 2

In the versions of Minetest before 0.4 the nodenames havent prefixed the modname. To be able to load old maps with the new versions the legacy mod adds aliases to convert the nodenames:

minetest.register_alias("dirt", "default:dirt")
Personal tools
Namespaces

Variants
Actions
Navigation
API
Toolbox