Recipe constructor
Recipe(})
A basic recipe takes in ingredient Items with the slot and a result Item. The recipes of a craftingtable are instantiated in the recipes field. A basic recipe takes in ingredient Items with the slot and a result Item.
Recipe | |
---|---|
Map<slot,Item> | The ingredients as a Map with the Slot(1 to 9) on the one side and your Item on the other |
Item | your result Item |
name | name of your recipe file(default = recipe) |
id | overrides the automatically generated id(optional) |
exactlyPlaced | bool that requires to leave all unused slots empty(default = false) |
exactResult | a number that limits the result count(optional) |
Example:
Recipe(
{
1: Item(Blocks.oak_planks),
2: Item(Blocks.oak_planks),
4: Item(Blocks.oak_planks),
5: Item(Blocks.oak_planks),
},
Item(Blocks.crafting_table,Count:2,nbt:{'MyNBT':1})
)
You can also set the Count variable of any of the items to generate a ratio. In this case you craft 2 craftingtables out of 4 oak_planks.
Implementation
Recipe(
this.ingredients,
this.result, {
this.name = 'recipe',
this.id,
this.exactlyPlaced = false,
this.exactResult,
this.type = RecipeType.shaped,
this.experience = 0.1,
this.cookingtime = 200,
});