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:

  • [id]
  • [id]:[metadata]
  • [id] [quantity]
  • [id]:[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 id 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:
  • [id]
  • [id]:[metadata]
  • [alias]
  • :[ore dictionary class]

Examples

// A sapling above a dirt block -> one grass block
mod.addRecipe("2", 1, 2, "6", "3");

// An oak sapling above a dirt block -> three grass blocks
mod.addRecipe("2 3", 1, 2, "6:0", "3");

// The same as the first example but uses aliases
mod.addAlias(2, "grass");
mod.addAlias(3, "dirt");
mod.addAlias(6, "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("2", "6", "3");

// A oak sapling and a dirt block -> one grass block
mod.addShapelessRecipe("2", "6:0", "3");

// The same as the first example but uses aliases
mod.addAlias(2, "grass");
mod.addAlias(3, "dirt");
mod.addAlias(6, "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]", ...);