Minecraft Mod Custom Stuff Wiki


175pages on
this wiki
Add New Page
Comments0 Share
CS1 Custom Stuff 1

Information presented below this line is outdated syntax or information used for Custom Stuff 1. It will not work with Custom Stuff 2.

Craftingafter is a set of functions that activate after a recipe is crafted. When combined with craftingbefore functions, you can even prevent an item from being used up in a recipe. An example of how to do this will be shown after the functions section.


Function Description Arguments
setInventorySlot changes specified slot int slotid, int id, int count, int damage
damageItem "hey,dont break my %item_name%!!!" int slotid, int damage


For this example, a pickaxe will be used to 'crack' stone bricks. The pickaxe will be kept in the crafting table but will be damaged. If all you want is to see how the functions look when used, just skip to the second box of code.

First, we will start with the recipes. Below are recipes for each pickaxe type.

recipes.addRecipe("98-2 1 1 2 270 98", "var toolID=270; customstuff.loadScript('recipeTool.script')", "vanilla");
recipes.addRecipe("98-2 1 1 2 274 98", "var toolID=274; customstuff.loadScript('recipeTool.script')", "vanilla");
recipes.addRecipe("98-2 1 1 2 257 98", "var toolID=257; customstuff.loadScript('recipeTool.script')", "vanilla");
recipes.addRecipe("98-2 1 1 2 285 98", "var toolID=285; customstuff.loadScript('recipeTool.script')", "vanilla");
recipes.addRecipe("98-2 1 1 2 278 98", "var toolID=278; customstuff.loadScript('recipeTool.script')", "vanilla");

The var toolID is so that you can use one script for all 5 vanilla pickaxes. This also works for custom pickaxes. Just change both of the id's for the pickaxe.

Next is the script file (recipeTool.script) that is used to keep, and damage, the pickaxe after each recipe is crafted.

var toolslot = craftingbefore.getSlot(toolID);
var tooldamage = craftingbefore.getItemDamage(toolslot);

craftingafter.setInventorySlot(toolslot, toolID, 1, tooldamage);
craftingafter.damageItem(toolslot, 1);

The craftingbefore functions grabs the slotid the pickaxe was in and how damaged it is. These values are then stored in variables that will be needed after we finish crafting the cracked stone bricks. After the recipe is crafted, the setInventorySlot function will change the now empty slot to a pickaxe with the same damage as before. The damageItem function then increases the pickaxe's damage by one, breaking the pickaxe if it reaches its limit.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.