This Article is up to date with Custom Stuff 2 CS2

In CS2, all you need to do to add a custom recipe to your game is to add a line for the recipe to the mod.js file. The format for your recipe is as seen below.

mod.addRecipe("[product] [quantity]", [width], [height], [ingredient 1], [ingredient 2], ...);

The [quantity] property is optional. If adding it, make sure to leave a space between the product and the quantity, otherwise you can leave off the space.

The actual product and ingredients can either be the item id OR an alias. You can also add a metadata number to the product or to the ingredients by adding a colon followed by the metadata number, and surround with quotes (example : "7791:3" for the ingrediant, or "3077:3 1" - which will give 1 x id 3077:metadata 3 - for the product ). An example with metadata :

mod.addRecipe("30138:2 1", 3, 3, "7761:3", "7761:3", "7761:3", "7761:3", 318, "7761:3", "7761:3", "7761:3", "7761:3")

To add an alias, you use either of the following:

mod.addAlias([block or item ID], "[alias name]");
mod.addAliasWithMetadata([block or item ID], [metadata number], "[alias name]");

Using aliases in your recipes can greatly improve readability and make them easier to edit. Aliases are added to the same mod.js file that your recipes are added to. Here are some examples showing the diamond pick, one with ids and the other using aliases.

mod.addRecipe("278 1", 3, 3, 264, 264, 264, 0, 280, 0, 0, 280, 0);

Now again with aliases

mod.addAlias(278, "diamondPick");
mod.addAlias(264, "diamond");
mod.addAlias(280, "stick");

mod.addRecipe("diamondPick 1", 3, 3, "diamond", "diamond", "diamond", 0, "stick", 0, 0, "stick", 0);

Although the second one takes a bit more to set up, it is easier to tell what is being used in the recipe. Additionally, and other recipes in the same mod.js file can use the same aliases without needing to add them again.

Shapeless Recipes

To add a shapeless recipe, the format is setup like this:

mod.addShapelessRecipe("[product] [quantity]", [ingredient 1], [ingredient 2], ...);

Some examples:

mod.addShapelessRecipe("361 4", 86);
//This is the recipe for pumpkin seeds.

mod.addShapelessRecipe("376 1", 375, 39, 353);
//This is the recipe for a fermented spider eye.

These examples can also be altered to use aliases as well.

Removing Recipes

To remove a recipe, the format is setup like this:

mod.removeRecipe("[product] [quantity]", [width], [height], [ingredient 1], [ingredient 2], ...);

As an example, let us remove the vanilla Ender Chest recipe.

mod.removeRecipe(130, 3, 3, 49, 49, 49, 49, 381, 49, 49, 49, 49);

Here is another example where the recipe removes a recipe (cookies) that gives multiple of the product.

mod.addAliasWithMetadata(351, 3, "cocoa");
mod.removeRecipe("357 8", 3, 1, 296, "cocoa", 296);

Finally, an example for removing shapeless recipes:

mod.addAliasWithMetadata(351, 15, "bonemeal");
mod.removeShapelessRecipe("bonemeal 2", 352);
//removes bonemeal recipe

As you can see from these examples, aliases can also be included when removing recipes. Once an alias is added to the mod.js file, the alias can be used in place of the id in any place within the mod.js file.

Damaging Items in Recipes

It is possible to make items such as pickaxes stay in the crafting table after a recipe by making them take one damage each recipe. In CS2, this done by adding a hyphen '-' at the end of the ingredient. Here are a few examples:

//recipes for stone to cobblestone, each different pickaxe
mod.addRecipe("4 1", 1, 2, "274-", 1);
mod.addRecipe("cobblestone", 1, 2, "goldPickaxe-", "stone");
mod.addRecipe("4 1", 1, 2, config.getItemId("cobaltPickaxeID") + "-", 1);

As you can see, you can use straight ids, aliases, or even functions/variables for this setup. It should also be possible to have more than one item at a time in a recipe to be damaged instead of removed.

Older Examples and Information for Custom Stuff 1.

To start making your custom crafting recipes, you'll need to create a .recipe file (like example.recipe) in your customRecipes folder. In this file, you can put as many recipes as you want.

Adding Recipes

Recipes can be added to a .recipe file with this function:

recipes.addRecipe("[ID of product] [quantity produced] [width] [height] [ID of ingredient 1] [ID of ingredient 2] ...", "[Scripting]", "[RecipesUsed]");

To include a damage value with an ID, place a hyphen followed by the damage value (ex: 35-11 is blue wool). There must be exactly [width]x[height] ingredients. Empty spaces are created by entering air (0) as an ingredient. Ingredients are listed left-to-right, top-to-bottom.

The "scripting" slot is usually and empty set of quotes used as a placeholder for any javascript you want to execute with the recipe.If you're creating something using the craftingbefore or craftingafter function triggers, this is where it would go.

The "Recipes Used" slot is used to tell Custom Stuff which crafting tables are able to create the recipe. Normally, you'll want the word "vanilla" in this slot signifying that the default crafting table is capable of making it. However, if you're using a GUI to make a custom crafting table, you may want to change this to a custom value.


recipes.addRecipe("278 1 3 3 264 264 264 0 280 0 0 280 0", "", "vanilla");

This is the recipe for a diamond pickaxe.

recipes.addRecipe("262 4 1 3 318 280 288", "", "vanilla");

This is the recipe for arrows.

Shapeless Recipes

Shapeless recipes are added using the same rules, except without any dimensions. The function is:

recipes.addShapelessRecipe("[ID of product] [quantity produced] [ID of ingredient 1] [ID of ingredient 2] ...", "[Scripting]", "[RecipesUsed]");

Damage values are listed the same way as with shaped recipes. There can be anywhere from one to nine ingredients, and the order that they are listed in does not affect the outcome.


recipes.addShapelessRecipe("376 1 375 39 353", "", "vanilla");

This is the recipe for a fermented spider eye.

recipes.addShapelessRecipe("361 4 86", "", "vanilla");

This is the recipe for pumpkin seeds.

Removing Recipes

In a .recipe file you can remove recipes with the following functions:

recipes.removeRecipe("[ID of product] [quantity produced] [width] [height] [ID of ingredient 1] [ID of ingredient 2] ...", "[RecipesUsed]");

recipe.removeShapelessRecipe("[ID of product] [quantity produced] [ID of ingredient 1] [ID of ingredient 2] ..." "[RecipesUsed]");

So the arguments are the same as for the addRecipe and addShapelessRecipe functions, except that there is no middle space for any scripting to be inserted.


recipes.removeRecipe("50 4 1 2 263 280", "vanilla");

This will remove the recipe for torches.

recipes.removeShapelessRecipe("351-15 2 352", "vanilla");
This will remove the recipe for bone meal.
Community content is available under CC-BY-SA unless otherwise noted.