Groups

From Minetest Developer Wiki
Jump to: navigation, search

Groups can be used for several things in Minetest. They are mostly used to define the digging times of nodes, but there many other uses.

Contents

Define groups

The groups of a node or tool are defined in the definiton table:

minetest.register_node("mod:testnode", {
	-- [...]
	groups = {crumbly=1, meat=2,},
})

The rating can be any integer, but 0 is equal to nil. Please refer to lua_api.txt for a full and up-to-date explanation on groups.

Group names

This section lists some groups which are used.

Special groups

These groups are directly used by Minetest to treat group members differently, and they are not tied to any particular mod or game. You can find a full list of special groups in in lua_api.txt.

Custom groups

Everyone can freely invent new groups on the fly. In this wiki, we document group names that modders use frequently.

Other uses

Mods can use groups for whatever they want. They can be used in crafting recipes, ABM definitions and more functions like this: "group:groupname" (e.g. "group:crumbly").

To use them in the mod code the function minetest.get_item_group("name", "group") is useful.

Personal tools
Namespaces

Variants
Actions
Navigation
API
Toolbox