Crafting Recipes
Shaped Recipes
To create a shaped crafting recipe, you have to add a single line to your mod.js file:
mod.addRecipe("[result]", [width], [height], "[ingredient 1]", "[ingredient 2]", ...);
result
This is the result of the crafting recipe. It can be one of the following:
- [item name]
- [item name]:[metadata]
- [item name] [quantity]
- [item name]:[metadata] [quantity]
- [alias]
- [alias] [quantity]
If quantity is not specified, 1 is used. If metadata is not specified, every metadata can be used for the recipe. The alias specifies item name and metadata.
width
This is the width of the recipe. It has to be 1, 2 or 3.
height
This is the height of the recipe. It has to be 1, 2 or 3.
ingredient
There has to be width x height ingredients. They are arranged from left to right and top to bottom. It can be one of the following:
- [item name]
- [item name]:[metadata]
- [alias]
- :[ore dictionary class]
Examples
// A sapling above a dirt block -> one grass block
mod.addRecipe("minecraft:grass", 1, 2, "minecraft:sapling", "minecraft:dirt");
// An oak sapling above a dirt block -> three grass blocks
mod.addRecipe("minecraft:grass 3", 1, 2, "minecraft:sapling:0", "minecraft:dirt");
// The same as the first example but uses aliases
mod.addAlias("minecraft:grass", "grass");
mod.addAlias("minecraft:dirt", "dirt");
mod.addAlias("minecraft:sapling", "sapling");
mod.addRecipe("grass", 1, 2, "sapling", "dirt");
mod.addRecipe("minecraft:grass", 1, 2, "minecraft:sapling", "minecraft:dirt");
// An oak sapling above a dirt block -> three grass blocks
mod.addRecipe("minecraft:grass 3", 1, 2, "minecraft:sapling:0", "minecraft:dirt");
// The same as the first example but uses aliases
mod.addAlias("minecraft:grass", "grass");
mod.addAlias("minecraft:dirt", "dirt");
mod.addAlias("minecraft:sapling", "sapling");
mod.addRecipe("grass", 1, 2, "sapling", "dirt");
Shapeless Recipes
To create a shapeless crafting recipe, you have to add a single line to your mod.js file:
mod.addShapelessRecipe("[result]", "[ingredient 1]", "[ingredient 2]", ...);
Examples
// A sapling and a dirt block -> one grass block
mod.addShapelessRecipe("minecraft:grass", "minecraft:sapling", "minecraft:dirt");
// A oak sapling and a dirt block -> one grass block
mod.addShapelessRecipe("minecraft:grass", "minecraft:sapling:0", "minecraft:dirt");
// The same as the first example but uses aliases
mod.addAlias("minecraft:grass", "grass");
mod.addAlias("minecraft:dirt", "dirt");
mod.addAlias("minecraft:sapling", "sapling");
mod.addShapelessRecipe("grass", "sapling", "dirt");
mod.addShapelessRecipe("minecraft:grass", "minecraft:sapling", "minecraft:dirt");
// A oak sapling and a dirt block -> one grass block
mod.addShapelessRecipe("minecraft:grass", "minecraft:sapling:0", "minecraft:dirt");
// The same as the first example but uses aliases
mod.addAlias("minecraft:grass", "grass");
mod.addAlias("minecraft:dirt", "dirt");
mod.addAlias("minecraft:sapling", "sapling");
mod.addShapelessRecipe("grass", "sapling", "dirt");
Removing Recipes
To remove a recipe, you have to add a single line to your mod.js file:
// Removes a shaped recipe
mod.removeRecipe("[result]", [width], [height], "[ingredient 1]", "[ingredient 2]", ...);
// Removes a shapeless recipe
mod.removeShapelessRecipe("[result]", "[ingredient 1]", "[ingredient 2]", ...);
mod.removeRecipe("[result]", [width], [height], "[ingredient 1]", "[ingredient 2]", ...);
// Removes a shapeless recipe
mod.removeShapelessRecipe("[result]", "[ingredient 1]", "[ingredient 2]", ...);