Mirred Shaped Recipes
Link to mirred-shaped-recipes
Mirrored Shaped Recipes are recipes that are very similar to normal Shaped Recipes, except that the inputs can be mirrored on both axis, an example of a recipe like this in the Vanilla game would be tools, like the Axe recipe below.
There is one difference between CraftTweaker mirrored recipes and Vanilla mirrored Recipes, by default CraftTweaker mirrored recipes can be mirrored on both axis, so not only are the left and right side of the Crafting Grid mirrored, but also the top and the bottom, as an example, the images below are from a single mirrored recipe.
Adding Mirrored Shaped Recipes
Link to adding-mirrored-shaped-recipes
Adding Mirrored Shaped Recipes is exactly the same as adding normal Shaped Recipes except it uses a different method.
The basic syntax for a mirrored shaped recipe is:
// craftingTable.addShapedMirrored(recipeName as string, // output as IItemStack, // ingredients as IIngredient, // recipeFunction as @optional RecipeFunctionMatrix);
The optional RecipeFunctionMatrix at the end of the method is only needed for advanced recipe where the output changes depending on the input, an example being transfering NBT data from one of the input ingredients to the output item.
In general, most of your recipes are not going to be using the function, but it is there if you need it.
recipeName has some restrictions that should be kept in mind:
- The name you provide is the "path" value of the name of the recipe, all recipes added through CraftTweaker will have the
crafttweakermodid as part of the name.<br/>For example, if you provide "boat" as the name, the full recipe name will be
- It needs to be unique, using a non-unique recipe name will cause your recipe to replace the previous recipe.
- It cannot contain spaces or colons (
- It must be all lowercased.
- It cannot start with
"autogenerated/"as it is a reserved CraftTweaker folder.
output, something to note is that it has to be an IItemStack, passing in an IIngredient will not work, so using
<item:minecraft:diamond> | <item:minecraft:dirt> will not work as they are both IIngredients, but using
<item:minecraft:diamond> is valid and will work.
Here is an example of how to add a Mirrored Shaped recipe that will accept three Apples, one in the top left slot, one in the center middle slot and one in the top right slot and output an Arrow.
For a recipe like this, you don't need the recipe function, so it is simply left out.
Since this is a mirrored recipe, the Apples can either be placed in the top left and right slots, or the bottom left and right slots.
craftingTable.addShapedMirrored("mirrored_apples_to_arrows", <item:minecraft:arrow>, [ [<item:minecraft:apple>, <item:minecraft:air>, <item:minecraft:apple>], [<item:minecraft:air>, <item:minecraft:apple>, <item:minecraft:air>]]);
Recipe functions work exactly the same as they do on normal Shaped Recipes, with the index of the
inputs array matching the provided input, so if you put an Apple in the top left slot,
inputs will always refer to that apple regardless of where it is on the grid.