minetest.register_craft

From Minetest Developer Wiki
Jump to: navigation, search

Syntax

minetest.register_craft({craft_recipe})

Description

Registers a recipe for crafting. Crafting results can be gotten via minetest.get_craft_result(input), via minetest.get_craft_recipe(output).

craft_recipe is table with the following fields:

  • type = "string" — one of these:
  • "" — normal craft, shaped
  • "shapeless" — normal craft, shapeless
  • "toolrepair" — two tools of the same type are fusioned to one + additional_wear
  • "cooking" — recipe for furnace
  • "fuel" — declare fuel
  • output = ItemString — the output of the craft or cooking
note.png
Note: Do not use internal quotes in here, it causes some bugs in minetest.get_craft_result()


  • recipe = 3×3 table — craft recipe for shaped craft
  • recipe = table with ItemStrings — recipe for type = "shapeless"
  • recipe = ItemString — recipe for type = "cooking" or item for type = "fuel"
  • replacements = table of itempairs — replace the first item with the second one on crafting
  • additional_wear = float — additional wear for type = "toolrepair"
note.png
Note: Use negative values to repair the tool


  • cooktime = float — cooktime for type = "cooking"
  • burntime = float — burntime for type = "fuel"

Examples

minetest.register_craft({
	output = "default:chest",
	recipe = {
		{"default:wood", "default:wood", "default:wood"},
		{"default:wood", "", "default:wood"},
		{"default:wood", "default:wood", "default:wood"}
	}
})


minetest.register_craft({
	type = "shapeless",
	output = "wool:green",
	recipe = {"group:wool", "dye:green"},
	replacements = {
		{"dye:green", "test:testnode"}
	}
})
Personal tools
Namespaces

Variants
Actions
Navigation
API
Toolbox