Advanced Recipes
Link to advanced-recipes
所属包
Link to 所属包
ZenScript Copyimport mods.ic2.AdvRecipes;
Recipe Types
Link to recipe-types
There are several types of recipes:
Shaped Recipes
Link to shaped-recipes
Shaped Recipes are recipes, where it matters, which item goes into which slot. For example, you can't just arrange 7 different sized stacks of iron ingots in any order to create iron leggings. The shape matters, thus it is a shaped recipe.
Shapeless Recipes
Link to shapeless-recipes
Shapeless Recipes are recipes, where only the items you put in the crafting grid matter, whereas the shape is of no importance. For example, blue and yellow dye create green dye. This recipe doesn't care about where you put which item.
Add Recipes
Link to add-recipes
addShaped
Link to addshaped
ZenScript Copymods.ic2.AdvRecipes.addShaped(output,inputs);
This creates a shaped recipe for output
using inputs
as Ingredients.
output
is an IItemStack
inputs
is an IIngredient[][] (see below)
inputs
is a 2 Dimensional IIngredient Array.
So the recipe for Iron Leggings would be written as [[iron,iron,iron],[iron,null,iron],[iron,null,iron]]
If that looks to confusing, try splitting the arrays up into one array per line
ZenScript Copyval iron = <minecraft:iron_ingot>;
val leggings = <minecraft:iron_leggings>;
AdvRecipes.addShaped(leggings,
[[iron * 5,iron * 7,iron * 5],
[iron * 3,null,iron * 3],
[iron,null,iron]]);
addShapeless
Link to addshapeless
ZenScript Copymods.ic2.AdvRecipes.addShapeless(output,inputs)
This creates a shapeless stacked recipe for output
using inputs
as Ingredients.
output
is an IItemStack
inputs
is an IIngredient[] (e.g. [minecraft:dye:1,minecraft:dye:2])
addHidden
Link to addhidden
ZenScript Copymods.ic2.AdvRecipes.addHiddenShapeless(IItemStack output, IIngredient[] ingredients);
mods.ic2.AdvRecipes.addHiddenShaped(IItemStack output, IIngredient[][] ingredients);
This creates a shaped or shapeless stacked recipe for output
using inputs
as Ingredients that is hidden.