OpenMiner/docs/lua-api-recipe.md

1.6 KiB

Lua API: Recipe

Example

Crafting recipe

mod:crafting_recipe {
	result = {
		id = "default:wooden_axe",
		amount = 1
	},

	pattern = {
		"##",
		"#|",
		" |"
	},

	keys = {
		['#'] = "default:oak_planks",
		['|'] = "default:stick",
	}
}

Smelting recipe

mod:smelting_recipe {
	input = {
		id = "default:iron_ore",
		amount = 1
	},

	output = {
		id = "default:iron_ingot",
		amount = 1
	}
}

Attributes

Crafting recipe

result

Item stack created with the craft.

Example

result = {
	id = "default:wooden_axe",
	amount = 1
}

Possible attributes:

  • id: String ID of the item created.
  • amount: Amount of items in the created stack.

pattern

Pattern of the craft.

Example:

pattern = {
	"##",
	"#|",
	" |",
}

keys

Mapping of the characters used in pattern to actual item string IDs.

Note: Keys can also be groups. See Item#Attributes#groups for more details.

Example:

keys = {
	['#'] = "default:oak_planks",
	['|'] = "default:stick",
}

Smelting recipe

input

Item stack used as input for the recipe.

Example:

input = {
	id = "default:cobblestone",
	amount = 1
}

Possible attributes:

  • id: String ID of the item created.
  • amount: Amount of items in the created stack.

Note: id can also be a group. See Item#Attributes#groups for more details.

output

Item stack created with the recipe.

Example:

output = {
	id = "default:stone",
	amount = 1
}

Possible attributes:

  • id: String ID of the item created.
  • amount: Amount of items in the created stack