Crafting Recipes
Shaped Recipes
To create a shaped crafting recipe, you have to add a single line to your mod.js file:
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]
If you want to damage an item in a recipe, add a "-" right after the ingredient like this: "minecraft:pickaxe_iron-".
Examples
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:
Examples
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");
// Create a cobblestone with a stone and a pickaxe but only damage the pickaxe
mod.addShapelessRecipe("minecraft:cobblestone", "minecraft:stone", "minecraft:iron_pickaxe-");
Removing Recipes
To remove a recipe, you have to add a single line to your mod.js file. Do not add a "-" for damageable items:
mod.removeRecipe("[result]", [width], [height], "[ingredient 1]", "[ingredient 2]", ...);
// Removes a shapeless recipe
mod.removeShapelessRecipe("[result]", "[ingredient 1]", "[ingredient 2]", ...);