public class CraftingHelpers
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
CraftingHelpers.IIdentifierGenerator
Generates semi-unique IDs.
|
| Constructor and Description |
|---|
CraftingHelpers() |
| Modifier and Type | Method and Description |
|---|---|
protected static <T1,M1,T2,M2> |
addRemainderAsSurplusForComponent(org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T1,M1> ingredientComponent,
java.util.List<T1> instances,
org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionPrototypeMap<T1,M1> simulatedExtractionMemory,
org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T2,M2> blackListComponent,
T2 blacklistInstance,
M2 blacklistCondition,
long blacklistQuantity) |
static <T,M> CraftingJob |
calculateAndScheduleCraftingJob(org.cyclops.integrateddynamics.api.network.INetwork network,
int channel,
org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent,
T instance,
M matchCondition,
boolean craftMissing,
boolean allowDistribution,
CraftingHelpers.IIdentifierGenerator identifierGenerator,
java.util.UUID initiator)
Schedule a crafting job for the given instance in the given network.
|
static CraftingJob |
calculateAndScheduleCraftingJob(org.cyclops.integrateddynamics.api.network.INetwork network,
int channel,
org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition recipe,
int amount,
boolean craftMissing,
boolean allowDistribution,
CraftingHelpers.IIdentifierGenerator identifierGenerator,
java.util.UUID initiator)
Schedule a crafting job for the given recipe in the given network.
|
protected static <T,M> PartialCraftingJobCalculationDependency |
calculateCraftingJobDependencyComponent(org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> dependencyComponent,
java.util.Map<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionPrototypeMap<?,?>> dependenciesOutputSurplus,
MissingIngredients<T,M> missingIngredients,
java.util.Set<org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient> parentDependencies,
java.util.Map<org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition,CraftingJob> dependencies,
IRecipeIndex recipeIndex,
int channel,
java.util.function.Function<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage> storageGetter,
java.util.Map<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionPrototypeMap<?,?>> simulatedExtractionMemory,
CraftingHelpers.IIdentifierGenerator identifierGenerator,
CraftingJobDependencyGraph craftingJobsGraph,
boolean collectMissingRecipes) |
static <T,M> CraftingJob |
calculateCraftingJobs(org.cyclops.integrateddynamics.api.network.INetwork network,
int channel,
org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent,
T instance,
M matchCondition,
boolean craftMissing,
CraftingHelpers.IIdentifierGenerator identifierGenerator,
CraftingJobDependencyGraph craftingJobsGraph,
boolean collectMissingRecipes)
Calculate the required crafting jobs and their dependencies for the given instance in the given network.
|
static CraftingJob |
calculateCraftingJobs(org.cyclops.integrateddynamics.api.network.INetwork network,
int channel,
org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition recipe,
int amount,
boolean craftMissing,
CraftingHelpers.IIdentifierGenerator identifierGenerator,
CraftingJobDependencyGraph craftingJobsGraph,
boolean collectMissingRecipes)
Calculate the required crafting jobs and their dependencies for the given instance in the given network.
|
protected static <T,M> CraftingJob |
calculateCraftingJobs(IRecipeIndex recipeIndex,
int channel,
java.util.function.Function<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage> storageGetter,
org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent,
T instance,
M matchCondition,
boolean craftMissing,
java.util.Map<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionPrototypeMap<?,?>> simulatedExtractionMemory,
CraftingHelpers.IIdentifierGenerator identifierGenerator,
CraftingJobDependencyGraph craftingJobsGraph,
java.util.Set<org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient> parentDependencies,
boolean collectMissingRecipes)
Calculate a crafting job for the given instance.
|
protected static PartialCraftingJobCalculation |
calculateCraftingJobs(IRecipeIndex recipeIndex,
int channel,
java.util.function.Function<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage> storageGetter,
org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition recipe,
int amount,
boolean craftMissing,
java.util.Map<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionPrototypeMap<?,?>> simulatedExtractionMemory,
CraftingHelpers.IIdentifierGenerator identifierGenerator,
CraftingJobDependencyGraph craftingJobsGraph,
java.util.Set<org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient> parentDependencies,
boolean collectMissingRecipes)
Calculate a crafting job for the given recipe.
|
protected static org.cyclops.commoncapabilities.api.ingredient.IMixedIngredients |
compressMixedIngredients(org.cyclops.commoncapabilities.api.ingredient.IMixedIngredients mixedIngredients)
Stack all ingredients in the given mixed ingredients object.
|
static <T,M> java.util.List<org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient<T,M>> |
getCompressedIngredients(org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent,
org.cyclops.commoncapabilities.api.ingredient.IMixedIngredients mixedIngredients)
Create a list of prototyped ingredients from the instances
of the given ingredient component type in the given mixed ingredients.
|
static ICraftingNetwork |
getCraftingNetwork(org.cyclops.integrateddynamics.api.network.INetwork network)
Get the crafting network in the given network.
|
static CraftingHelpers.IIdentifierGenerator |
getGlobalCraftingJobIdentifier() |
static <T,M> org.apache.commons.lang3.tuple.Pair<java.util.List<T>,MissingIngredients<T,M>> |
getIngredientRecipeInputs(org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage<T,M> storage,
org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent,
org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition recipe,
boolean simulate,
org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionPrototypeMap<T,M> simulatedExtractionMemory,
boolean collectMissingIngredients,
long recipeOutputQuantity)
Get all required recipe input ingredients from the network for the given ingredient component,
and optionally, explicitly calculate the missing ingredients.
|
static <T,M> java.util.List<T> |
getIngredientRecipeInputs(org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage<T,M> storage,
org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent,
org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition recipe,
boolean simulate,
long recipeOutputQuantity)
Get all required recipe input ingredients from the network for the given ingredient component.
|
static <T,M> org.cyclops.integrateddynamics.api.network.IPositionedAddonsNetworkIngredients<T,M> |
getIngredientsNetwork(org.cyclops.integrateddynamics.api.network.INetwork network,
org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent)
Get the storage network of the given type in the given network.
|
static org.cyclops.integrateddynamics.api.network.INetwork |
getNetworkChecked(org.cyclops.integrateddynamics.api.part.PartPos pos)
Get the network at the given position,
or throw a PartStateException if it is null.
|
static <T,M> org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage<T,M> |
getNetworkStorage(org.cyclops.integrateddynamics.api.network.INetwork network,
int channel,
org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent,
boolean scheduleObservation)
Get the storage of the given ingredient component type from the network.
|
static java.util.function.Function<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage> |
getNetworkStorageGetter(org.cyclops.integrateddynamics.api.network.INetwork network,
int channel,
boolean scheduleObservation)
Create a callback function for getting a storage for an ingredient component from the given network channel.
|
static <T,M> long |
getOutputQuantityForRecipe(org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition recipe,
org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent,
T instance,
M matchCondition)
Calculate the effective quantity for the given instance in the output of the given recipe.
|
static org.apache.commons.lang3.tuple.Pair<java.util.Map<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,java.util.List<?>>,java.util.Map<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,MissingIngredients<?,?>>> |
getRecipeInputs(java.util.function.Function<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage> storageGetter,
org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition recipe,
boolean simulate,
java.util.Map<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionPrototypeMap<?,?>> simulatedExtractionMemories,
boolean collectMissingIngredients,
long recipeOutputQuantity)
Get all required recipe input ingredients based on a given storage callback.
|
static org.cyclops.commoncapabilities.api.ingredient.IMixedIngredients |
getRecipeInputs(org.cyclops.integrateddynamics.api.network.INetwork network,
int channel,
org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition recipe,
boolean simulate,
long recipeOutputQuantity)
Get all required recipe input ingredients from the network.
|
static java.util.Map<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,java.util.List<org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient<?,?>>> |
getRecipeOutputs(org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition recipe)
Create a collection of prototypes from the given recipe's outputs.
|
static <T,M> boolean |
hasStorageInstance(org.cyclops.integrateddynamics.api.network.INetwork network,
int channel,
org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent,
T instance,
M matchCondition)
Check if the given network contains the given instance in any of its storages.
|
static boolean |
insertCrafting(java.util.function.Function<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,org.cyclops.integrateddynamics.api.part.PartPos> targetGetter,
org.cyclops.commoncapabilities.api.ingredient.IMixedIngredients ingredients,
org.cyclops.integrateddynamics.api.network.INetwork network,
int channel,
boolean simulate)
Insert the ingredients of all applicable ingredient component types into the target to make it start crafting.
|
static <T,M> boolean |
insertIngredientCrafting(org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent,
net.minecraftforge.common.capabilities.ICapabilityProvider capabilityProvider,
net.minecraft.util.EnumFacing side,
org.cyclops.commoncapabilities.api.ingredient.IMixedIngredients ingredients,
org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage<T,M> storageFallback,
boolean simulate)
Insert the ingredients of the given ingredient component type into the target to make it start crafting.
|
static org.cyclops.commoncapabilities.api.ingredient.IMixedIngredients |
insertIngredients(org.cyclops.commoncapabilities.api.ingredient.IMixedIngredients ingredients,
java.util.function.Function<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage> storageGetter,
boolean simulate)
Insert the given ingredients into the given storage networks.
|
static <T,M> boolean |
isCrafting(ICraftingNetwork craftingNetwork,
int channel,
org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent,
T instance,
M matchCondition)
Check if there is a scheduled crafting job for the given instance.
|
static boolean |
isCrafting(ICraftingNetwork craftingNetwork,
int channel,
org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition recipe)
Check if there is a scheduled crafting job for the given recipe.
|
static org.cyclops.commoncapabilities.api.ingredient.IMixedIngredients |
mergeMixedIngredients(org.cyclops.commoncapabilities.api.ingredient.IMixedIngredients a,
org.cyclops.commoncapabilities.api.ingredient.IMixedIngredients b)
Merge two mixed ingredients in a new mixed ingredients object.
|
static <T,M> org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient<T,M> |
multiplyPrototypedIngredient(org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient<T,M> prototypedIngredient,
long amount)
Multiply the quantity of a given prototyped ingredient with the given amount.
|
static <T,M> java.util.List<org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient<T,M>> |
multiplyPrototypedIngredients(java.util.List<org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient<T,M>> prototypedIngredients,
long amount)
Multiply the quantity of a given prototyped ingredient list with the given amount.
|
static java.util.Map<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,java.util.List<org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient<?,?>>> |
multiplyRecipeOutputs(java.util.Map<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,java.util.List<org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient<?,?>>> recipeOutputs,
int amount)
Creates a new recipe outputs object with all ingredient quantities multiplied by the given amount.
|
static CraftingJob |
scheduleCraftingJob(ICraftingNetwork craftingNetwork,
CraftingJob craftingJob,
boolean allowDistribution,
java.util.UUID initiator)
Schedule the given crafting job in the given network.
|
static void |
scheduleCraftingJobs(ICraftingNetwork craftingNetwork,
CraftingJobDependencyGraph craftingJobDependencyGraph,
boolean allowDistribution,
java.util.UUID initiator)
Schedule all crafting jobs in the given dependency graph in the given network.
|
static java.util.List<CraftingJob> |
splitCraftingJobs(CraftingJob craftingJob,
int splitFactor,
CraftingJobDependencyGraph dependencyGraph,
CraftingHelpers.IIdentifierGenerator identifierGenerator)
Split the given crafting job amount into new jobs with a given split factor.
|
public static org.cyclops.integrateddynamics.api.network.INetwork getNetworkChecked(org.cyclops.integrateddynamics.api.part.PartPos pos)
throws org.cyclops.integrateddynamics.api.PartStateException
pos - A position.org.cyclops.integrateddynamics.api.PartStateException - If the network could not be found.@Nullable public static ICraftingNetwork getCraftingNetwork(@Nullable org.cyclops.integrateddynamics.api.network.INetwork network)
network - A network.@Nullable
public static <T,M> org.cyclops.integrateddynamics.api.network.IPositionedAddonsNetworkIngredients<T,M> getIngredientsNetwork(org.cyclops.integrateddynamics.api.network.INetwork network,
org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent)
T - The instance type.M - The matching condition parameter.network - A network.ingredientComponent - The ingredient component type of the network.public static <T,M> org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage<T,M> getNetworkStorage(org.cyclops.integrateddynamics.api.network.INetwork network,
int channel,
org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent,
boolean scheduleObservation)
T - The instance type.M - The matching condition parameter.network - The network.channel - A network channel.ingredientComponent - The ingredient component type of the network.scheduleObservation - If an observation inside the ingredients network should be scheduled.public static <T,M> CraftingJob calculateCraftingJobs(org.cyclops.integrateddynamics.api.network.INetwork network, int channel, org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent, T instance, M matchCondition, boolean craftMissing, CraftingHelpers.IIdentifierGenerator identifierGenerator, CraftingJobDependencyGraph craftingJobsGraph, boolean collectMissingRecipes) throws UnknownCraftingRecipeException, RecursiveCraftingRecipeException
T - The instance type.M - The matching condition parameter.network - The target network.channel - The target channel.ingredientComponent - The ingredient component type of the instance.instance - The instance to craft.matchCondition - The match condition of the instance.craftMissing - If the missing required ingredients should also be crafted.identifierGenerator - identifierGenerator An ID generator for crafting jobs.craftingJobsGraph - The target graph where all dependencies will be stored.collectMissingRecipes - If the missing recipes should be collected inside
UnknownCraftingRecipeException.
This may slow down calculation for deeply nested recipe graphs.UnknownCraftingRecipeException - If the recipe for a (sub)ingredient is unavailable.RecursiveCraftingRecipeException - If an infinite recursive recipe was detected.public static CraftingJob calculateCraftingJobs(org.cyclops.integrateddynamics.api.network.INetwork network, int channel, org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition recipe, int amount, boolean craftMissing, CraftingHelpers.IIdentifierGenerator identifierGenerator, CraftingJobDependencyGraph craftingJobsGraph, boolean collectMissingRecipes) throws FailedCraftingRecipeException, RecursiveCraftingRecipeException
network - The target network.channel - The target channel.recipe - The recipe to calculate a job for.amount - The amount of times the recipe should be crafted.craftMissing - If the missing required ingredients should also be crafted.identifierGenerator - identifierGenerator An ID generator for crafting jobs.craftingJobsGraph - The target graph where all dependencies will be stored.collectMissingRecipes - If the missing recipes should be collected inside
FailedCraftingRecipeException.
This may slow down calculation for deeply nested recipe graphs.FailedCraftingRecipeException - If the recipe could not be crafted due to missing sub-dependencies.RecursiveCraftingRecipeException - If an infinite recursive recipe was detected.public static CraftingHelpers.IIdentifierGenerator getGlobalCraftingJobIdentifier()
public static <T,M> long getOutputQuantityForRecipe(org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition recipe,
org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent,
T instance,
M matchCondition)
T - The instance type.M - The matching condition parameter.recipe - A recipe.ingredientComponent - The ingredient component.instance - An instance.matchCondition - A match condition.protected static <T,M> CraftingJob calculateCraftingJobs(IRecipeIndex recipeIndex, int channel, java.util.function.Function<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage> storageGetter, org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent, T instance, M matchCondition, boolean craftMissing, java.util.Map<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionPrototypeMap<?,?>> simulatedExtractionMemory, CraftingHelpers.IIdentifierGenerator identifierGenerator, CraftingJobDependencyGraph craftingJobsGraph, java.util.Set<org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient> parentDependencies, boolean collectMissingRecipes) throws UnknownCraftingRecipeException, RecursiveCraftingRecipeException
T - The instance type.M - The matching condition parameter.recipeIndex - The recipe index.channel - The target channel that will be stored in created crafting jobs.storageGetter - A callback function to get a storage for the given ingredient component.ingredientComponent - The ingredient component type of the instance.instance - The instance to craft.matchCondition - The match condition of the instance.craftMissing - If the missing required ingredients should also be crafted.simulatedExtractionMemory - This map remembers all extracted instances in simulation mode.
This is to make sure that instances can not be extracted multiple times
when simulating.identifierGenerator - An ID generator for crafting jobs.craftingJobsGraph - The target graph where all dependencies will be stored.parentDependencies - A set of parent recipe dependencies that are pending.
This is used to check for infinite recursion in recipes.collectMissingRecipes - If the missing recipes should be collected inside
UnknownCraftingRecipeException.
This may slow down calculation for deeply nested recipe graphs.UnknownCraftingRecipeException - If the recipe for a (sub)ingredient is unavailable.RecursiveCraftingRecipeException - If an infinite recursive recipe was detected.protected static PartialCraftingJobCalculation calculateCraftingJobs(IRecipeIndex recipeIndex, int channel, java.util.function.Function<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage> storageGetter, org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition recipe, int amount, boolean craftMissing, java.util.Map<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionPrototypeMap<?,?>> simulatedExtractionMemory, CraftingHelpers.IIdentifierGenerator identifierGenerator, CraftingJobDependencyGraph craftingJobsGraph, java.util.Set<org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient> parentDependencies, boolean collectMissingRecipes) throws RecursiveCraftingRecipeException
recipeIndex - The recipe index.channel - The target channel that will be stored in created crafting jobs.storageGetter - A callback function to get a storage for the given ingredient component.recipe - The recipe to calculate a job for.amount - The amount of times the recipe should be crafted.craftMissing - If the missing required ingredients should also be crafted.simulatedExtractionMemory - This map remembers all extracted instances in simulation mode.
This is to make sure that instances can not be extracted multiple times
when simulating.identifierGenerator - An ID generator for crafting jobs.craftingJobsGraph - The target graph where all dependencies will be stored.parentDependencies - A set of parent recipe dependencies that are pending.
This is used to check for infinite recursion in recipes.collectMissingRecipes - If the missing recipes should be collected inside
UnknownCraftingRecipeException.
This may slow down calculation for deeply nested recipe graphs.RecursiveCraftingRecipeException - If an infinite recursive recipe was detected.protected static <T,M> PartialCraftingJobCalculationDependency calculateCraftingJobDependencyComponent(org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> dependencyComponent, java.util.Map<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionPrototypeMap<?,?>> dependenciesOutputSurplus, MissingIngredients<T,M> missingIngredients, java.util.Set<org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient> parentDependencies, java.util.Map<org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition,CraftingJob> dependencies, IRecipeIndex recipeIndex, int channel, java.util.function.Function<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage> storageGetter, java.util.Map<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionPrototypeMap<?,?>> simulatedExtractionMemory, CraftingHelpers.IIdentifierGenerator identifierGenerator, CraftingJobDependencyGraph craftingJobsGraph, boolean collectMissingRecipes) throws RecursiveCraftingRecipeException
RecursiveCraftingRecipeExceptionprotected static <T1,M1,T2,M2> void addRemainderAsSurplusForComponent(org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T1,M1> ingredientComponent,
java.util.List<T1> instances,
org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionPrototypeMap<T1,M1> simulatedExtractionMemory,
org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T2,M2> blackListComponent,
T2 blacklistInstance,
M2 blacklistCondition,
long blacklistQuantity)
public static void scheduleCraftingJobs(ICraftingNetwork craftingNetwork, CraftingJobDependencyGraph craftingJobDependencyGraph, boolean allowDistribution, @Nullable java.util.UUID initiator)
craftingNetwork - The target crafting network.craftingJobDependencyGraph - The crafting job dependency graph.allowDistribution - If the crafting jobs are allowed to be split over multiple crafting interfaces.initiator - Optional UUID of the initiator.public static CraftingJob scheduleCraftingJob(ICraftingNetwork craftingNetwork, CraftingJob craftingJob, boolean allowDistribution, @Nullable java.util.UUID initiator)
craftingNetwork - The target crafting network.craftingJob - The crafting job to schedule.allowDistribution - If the crafting job is allowed to be split over multiple crafting interfaces.initiator - Optional UUID of the initiator.@Nullable public static <T,M> CraftingJob calculateAndScheduleCraftingJob(org.cyclops.integrateddynamics.api.network.INetwork network, int channel, org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent, T instance, M matchCondition, boolean craftMissing, boolean allowDistribution, CraftingHelpers.IIdentifierGenerator identifierGenerator, @Nullable java.util.UUID initiator)
T - The instance type.M - The matching condition parameter.network - The target network.channel - The target channel.ingredientComponent - The ingredient component type of the instance.instance - The instance to craft.matchCondition - The match condition of the instance.craftMissing - If the missing required ingredients should also be crafted.allowDistribution - If the crafting job is allowed to be split over multiple crafting interfaces.identifierGenerator - An ID generator for crafting jobs.initiator - Optional UUID of the initiator.@Nullable public static CraftingJob calculateAndScheduleCraftingJob(org.cyclops.integrateddynamics.api.network.INetwork network, int channel, org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition recipe, int amount, boolean craftMissing, boolean allowDistribution, CraftingHelpers.IIdentifierGenerator identifierGenerator, @Nullable java.util.UUID initiator)
network - The target network.channel - The target channel.recipe - The recipe to craft.amount - The amount to craft.craftMissing - If the missing required ingredients should also be crafted.allowDistribution - If the crafting job is allowed to be split over multiple crafting interfaces.identifierGenerator - An ID generator for crafting jobs.initiator - Optional UUID of the initiator.public static <T,M> boolean hasStorageInstance(org.cyclops.integrateddynamics.api.network.INetwork network,
int channel,
org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent,
T instance,
M matchCondition)
T - The instance type.M - The matching condition parameter.network - The target network.channel - The target channel.ingredientComponent - The ingredient component type of the instance.instance - The instance to check.matchCondition - The match condition of the instance.public static <T,M> boolean isCrafting(ICraftingNetwork craftingNetwork, int channel, org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent, T instance, M matchCondition)
T - The instance type.M - The matching condition parameter.craftingNetwork - The target crafting network.channel - The target channel.ingredientComponent - The ingredient component type of the instance.instance - The instance to check.matchCondition - The match condition of the instance.public static boolean isCrafting(ICraftingNetwork craftingNetwork, int channel, org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition recipe)
craftingNetwork - The target crafting network.channel - The target channel.recipe - The recipe to check.@Nullable
public static <T,M> java.util.List<T> getIngredientRecipeInputs(org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage<T,M> storage,
org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent,
org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition recipe,
boolean simulate,
long recipeOutputQuantity)
T - The instance type.M - The matching condition parameter, may be Void.storage - The target storage.ingredientComponent - The ingredient component to get the ingredients for.recipe - The recipe to get the inputs from.simulate - If true, then the ingredients will effectively be removed from the network, not when false.recipeOutputQuantity - The number of times the given recipe should be applied.public static <T,M> org.apache.commons.lang3.tuple.Pair<java.util.List<T>,MissingIngredients<T,M>> getIngredientRecipeInputs(org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage<T,M> storage, org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent, org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition recipe, boolean simulate, org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionPrototypeMap<T,M> simulatedExtractionMemory, boolean collectMissingIngredients, long recipeOutputQuantity)
T - The instance type.M - The matching condition parameter, may be Void.storage - The target storage.ingredientComponent - The ingredient component to get the ingredients for.recipe - The recipe to get the inputs from.simulate - If true, then the ingredients will effectively be removed from the network, not when false.simulatedExtractionMemory - This map remembers all extracted instances in simulation mode.
This is to make sure that instances can not be extracted multiple times
when simulating.
The quantities can also go negatives,
which means that a surplus of the given instance is present,
which will be used up first before a call to the storage.collectMissingIngredients - If missing ingredients should be collected.
If false, then the first returned list may be null
if no valid matches can be found,
and the second returned list is always null,recipeOutputQuantity - The number of times the given recipe should be applied.@Nullable
public static org.cyclops.commoncapabilities.api.ingredient.IMixedIngredients getRecipeInputs(org.cyclops.integrateddynamics.api.network.INetwork network,
int channel,
org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition recipe,
boolean simulate,
long recipeOutputQuantity)
network - The target network.channel - The target channel.recipe - The recipe to get the inputs from.simulate - If true, then the ingredients will effectively be removed from the network, not when false.recipeOutputQuantity - The number of times the given recipe should be applied.public static java.util.function.Function<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage> getNetworkStorageGetter(org.cyclops.integrateddynamics.api.network.INetwork network,
int channel,
boolean scheduleObservation)
network - The target network.channel - The target channel.scheduleObservation - If an observation inside the ingredients network should be scheduled.public static org.apache.commons.lang3.tuple.Pair<java.util.Map<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,java.util.List<?>>,java.util.Map<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,MissingIngredients<?,?>>> getRecipeInputs(java.util.function.Function<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage> storageGetter, org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition recipe, boolean simulate, java.util.Map<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionPrototypeMap<?,?>> simulatedExtractionMemories, boolean collectMissingIngredients, long recipeOutputQuantity)
storageGetter - A callback function to get a storage for the given ingredient component.recipe - The recipe to get the inputs from.simulate - If true, then the ingredients will effectively be removed from the network, not when false.simulatedExtractionMemories - This map remembers all extracted instances in simulation mode.
This is to make sure that instances can not be extracted multiple times
when simulating.collectMissingIngredients - If missing ingredients should be collected.
If false, then the first returned mixed ingredients may be null
if no valid matches can be found,
and the second returned list is always null,recipeOutputQuantity - The number of times the given recipe should be applied.public static <T,M> java.util.List<org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient<T,M>> getCompressedIngredients(org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent,
org.cyclops.commoncapabilities.api.ingredient.IMixedIngredients mixedIngredients)
T - The instance type.M - The matching condition parameter.ingredientComponent - The ingredient component type.mixedIngredients - The mixed ingredients.public static java.util.Map<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,java.util.List<org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient<?,?>>> getRecipeOutputs(org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition recipe)
recipe - A recipe.public static java.util.Map<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,java.util.List<org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient<?,?>>> multiplyRecipeOutputs(java.util.Map<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,java.util.List<org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient<?,?>>> recipeOutputs,
int amount)
recipeOutputs - A recipe objects holder.amount - An amount to multiply all instances by.public static <T,M> java.util.List<org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient<T,M>> multiplyPrototypedIngredients(java.util.List<org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient<T,M>> prototypedIngredients,
long amount)
T - The instance type.M - The matching condition parameter.prototypedIngredients - A prototyped ingredient list.amount - An amount to multiply by.public static <T,M> org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient<T,M> multiplyPrototypedIngredient(org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient<T,M> prototypedIngredient,
long amount)
T - The instance type.M - The matching condition parameter.prototypedIngredient - A prototyped ingredient.amount - An amount to multiply by.public static org.cyclops.commoncapabilities.api.ingredient.IMixedIngredients mergeMixedIngredients(org.cyclops.commoncapabilities.api.ingredient.IMixedIngredients a,
org.cyclops.commoncapabilities.api.ingredient.IMixedIngredients b)
a - A first mixed ingredients object.b - A second mixed ingredients object.protected static org.cyclops.commoncapabilities.api.ingredient.IMixedIngredients compressMixedIngredients(org.cyclops.commoncapabilities.api.ingredient.IMixedIngredients mixedIngredients)
mixedIngredients - A mixed ingredients object.public static <T,M> boolean insertIngredientCrafting(org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent,
net.minecraftforge.common.capabilities.ICapabilityProvider capabilityProvider,
@Nullable
net.minecraft.util.EnumFacing side,
org.cyclops.commoncapabilities.api.ingredient.IMixedIngredients ingredients,
org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage<T,M> storageFallback,
boolean simulate)
T - The instance type.M - The matching condition parameter.ingredientComponent - The ingredient component type.capabilityProvider - The target capability provider.side - The target side.ingredients - The ingredients to insert.storageFallback - The storage to insert any failed ingredients back into. Can be null in simulation mode.simulate - If insertion should be simulated.public static boolean insertCrafting(java.util.function.Function<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,org.cyclops.integrateddynamics.api.part.PartPos> targetGetter,
org.cyclops.commoncapabilities.api.ingredient.IMixedIngredients ingredients,
org.cyclops.integrateddynamics.api.network.INetwork network,
int channel,
boolean simulate)
targetGetter - A function to get the target position.ingredients - The ingredients to insert.network - The network.channel - The channel.simulate - If insertion should be simulated.public static java.util.List<CraftingJob> splitCraftingJobs(CraftingJob craftingJob, int splitFactor, CraftingJobDependencyGraph dependencyGraph, CraftingHelpers.IIdentifierGenerator identifierGenerator)
craftingJob - A crafting job to split.splitFactor - The number of jobs to split the job over.dependencyGraph - The dependency graph that will be updated if there are dependencies in the original job.identifierGenerator - An identifier generator for the crafting jobs ids.public static org.cyclops.commoncapabilities.api.ingredient.IMixedIngredients insertIngredients(org.cyclops.commoncapabilities.api.ingredient.IMixedIngredients ingredients,
java.util.function.Function<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage> storageGetter,
boolean simulate)
ingredients - A collection of ingredients.storageGetter - A storage network getter.simulate - If insertion should be simulated.