Mirrored Shaped Recipes

Link to mirrored-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.

Axe with Wooden Planks on the left

Axe with Wooden Planks on the right

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.

Recipe with items in the top left slots

Recipe with items in the bottom right slots

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:

ZenScript
Copy
// 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.

The recipeName has some restrictions that should be kept in mind: 1) The name you provide is the "path" value of the name of the recipe, all recipes added through CraftTweaker will have the crafttweaker modid as part of the name.
For example, if you provide "boat" as the name, the full recipe name will be crafttweaker:boat. 2) It needs to be unique, using a non-unique recipe name will cause your recipe to replace the previous recipe. 3) It cannot contain spaces or colons (:). 4) It must be all lowercased. 5) It cannot start with "autogenerated/" as it is a reserved CraftTweaker folder.

For the output, something to note is that it has to be an IItemStack, passing in an IIngredient will not work, so using <tag:items:minecraft:wool> or <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.

ZenScript
Copy
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[0][0] will always refer to that apple regardless of where it is on the grid.