use of com.blakebr0.extendedcrafting.crafting.table.TableRecipeShapeless in project ExtendedCrafting by BlakeBr0.
the class TableCrafting method addShapeless.
@ZenMethod
public static void addShapeless(int tier, IItemStack output, IIngredient[] ingredients) {
if (tier > 4 || tier < 0) {
CraftTweakerAPI.getLogger().logError("Unable to assign a tier to the Table Recipe for stack " + output.getDisplayName() + ". Tier cannot be greater than 4 or less than 0.");
tier = 0;
}
Map<Integer, Function<ItemStack, ItemStack>> transformers = new HashMap<>();
for (int i = 0; i < ingredients.length; i++) {
IIngredient iing = ingredients[i];
Ingredient ing = CraftingHelper.getIngredient(toObject(iing));
if (ing != Ingredient.EMPTY && iing.hasNewTransformers()) {
transformers.put(i, stack -> {
IItemStack istack = iing.applyNewTransform(CraftTweakerMC.getIItemStack(stack));
ItemStack transformed = CraftTweakerMC.getItemStack(istack);
return transformed;
});
}
}
CraftTweakerAPI.apply(new Add(new TableRecipeShapeless(tier, toStack(output), toObjects(ingredients)).withTransforms(transformers)));
}
use of com.blakebr0.extendedcrafting.crafting.table.TableRecipeShapeless in project ExtendedCrafting by BlakeBr0.
the class EnderCrafting method addShapeless.
@ZenMethod
public static void addShapeless(IItemStack output, IIngredient[] ingredients, int seconds) {
TableRecipeShapeless recipe = new TableRecipeShapeless(1, toStack(output), toObjects(ingredients));
recipe.enderCrafterRecipeTimeRequired = seconds;
CraftTweakerAPI.apply(new Add(recipe));
}
use of com.blakebr0.extendedcrafting.crafting.table.TableRecipeShapeless in project ExtendedCrafting by BlakeBr0.
the class EnderCrafterRecipeManager method addShapeless.
public TableRecipeShapeless addShapeless(ItemStack result, int time, Object... ingredients) {
TableRecipeShapeless recipe = new TableRecipeShapeless(1, result, ingredients);
if (ModConfig.confEnderEnabled) {
recipe.enderCrafterRecipeTimeRequired = time;
this.recipes.add(recipe);
}
return recipe;
}
Aggregations