public class CraftingNetwork extends java.lang.Object implements ICraftingNetwork
| Constructor and Description |
|---|
CraftingNetwork() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addCraftingInterface(int channel,
ICraftingInterface craftingInterface)
Add a crafting interface to the network.
|
boolean |
addCraftingInterfaceRecipe(int channel,
ICraftingInterface craftingInterface,
org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition recipe)
Add the given recipe that is owned by the given crafting interface.
|
protected void |
addCraftingJob(int channel,
CraftingJob craftingJob,
ICraftingInterface craftingInterface) |
protected void |
cancelCraftingJob(CraftingJob craftingJob) |
boolean |
cancelCraftingJob(int channel,
int craftingJobId)
Cancel the given crafting job.
|
protected void |
cleanupChannelIfEmpty(int channel) |
int[] |
getChannels() |
java.util.Set<ICraftingInterface> |
getCraftingInterfaces(int channel)
Get all crafting interfaces for the given channel.
|
CraftingJob |
getCraftingJob(int channel,
int craftingJobId) |
CraftingJobDependencyGraph |
getCraftingJobDependencyGraph() |
ICraftingInterface |
getCraftingJobInterface(int channel,
int craftingJobId)
Get the interface in which the given crafting job is being crafted.
|
java.util.Iterator<CraftingJob> |
getCraftingJobs(int channel) |
<T,M> java.util.Iterator<CraftingJob> |
getCraftingJobs(int channel,
org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent,
T instance,
M matchCondition)
Get present crafting jobs for the given (expected) output instance.
|
protected long |
getCurrentTick() |
com.google.common.collect.Multimap<org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition,ICraftingInterface> |
getRecipeCraftingInterfaces(int channel)
Get the recipe to interface mapping for the given channel.
|
IRecipeIndexModifiable |
getRecipeIndex(int channel)
Get the recipe index on the given channel.
|
long |
getRunningTicks(CraftingJob craftingJob)
Calculate the number of ticks the given job has been running.
|
protected static com.google.common.collect.Multimap<org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition,ICraftingInterface> |
newRecipeCraftingInterfacesMap() |
void |
onCraftingJobFinished(CraftingJob craftingJob)
Called by crafting interfaces when the crafting job is finished and should be removed from all lists.
|
boolean |
removeCraftingInterface(int channel,
ICraftingInterface craftingInterface)
Remove a crafting interface from the network.
|
boolean |
removeCraftingInterfaceRecipe(int channel,
ICraftingInterface craftingInterface,
org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition recipe)
Remove the given recipe that is owned by the given crafting interface.
|
protected void |
removeCraftingJob(int channel,
CraftingJob craftingJob) |
void |
scheduleCraftingJob(CraftingJob craftingJob,
boolean allowDistribution)
Add the given crafting job to the list of crafting jobs.
|
protected static com.google.common.collect.Multimap<org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition,ICraftingInterface> newRecipeCraftingInterfacesMap()
public int[] getChannels()
getChannels in interface ICraftingNetworkpublic java.util.Set<ICraftingInterface> getCraftingInterfaces(int channel)
ICraftingNetworkgetCraftingInterfaces in interface ICraftingNetworkchannel - The crafting channel.public com.google.common.collect.Multimap<org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition,ICraftingInterface> getRecipeCraftingInterfaces(int channel)
ICraftingNetworkgetRecipeCraftingInterfaces in interface ICraftingNetworkchannel - The crafting channel.public IRecipeIndexModifiable getRecipeIndex(int channel)
ICraftingNetworkgetRecipeIndex in interface ICraftingNetworkchannel - The crafting channel.public boolean addCraftingInterface(int channel,
ICraftingInterface craftingInterface)
ICraftingNetworkaddCraftingInterface in interface ICraftingNetworkchannel - The channel of the interface.craftingInterface - A crafting interface.public boolean removeCraftingInterface(int channel,
ICraftingInterface craftingInterface)
ICraftingNetworkremoveCraftingInterface in interface ICraftingNetworkchannel - The channel of the interface.craftingInterface - A crafting interface.public boolean addCraftingInterfaceRecipe(int channel,
ICraftingInterface craftingInterface,
org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition recipe)
ICraftingNetworkICraftingNetwork.addCraftingInterface(int, ICraftingInterface) should be called.addCraftingInterfaceRecipe in interface ICraftingNetworkchannel - The channel of the interface.craftingInterface - A crafting interface.recipe - The recipe to add.public boolean removeCraftingInterfaceRecipe(int channel,
ICraftingInterface craftingInterface,
org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition recipe)
ICraftingNetworkICraftingNetwork.removeCraftingInterface(int, ICraftingInterface) should be called.removeCraftingInterfaceRecipe in interface ICraftingNetworkchannel - The channel of the interface.craftingInterface - A crafting interface.recipe - The recipe to remove.public void scheduleCraftingJob(CraftingJob craftingJob, boolean allowDistribution)
ICraftingNetworkscheduleCraftingJob in interface ICraftingNetworkcraftingJob - The crafting job.allowDistribution - If the crafting job is allowed to be split over multiple crafting interfaces.protected long getCurrentTick()
public void onCraftingJobFinished(CraftingJob craftingJob)
ICraftingNetworkonCraftingJobFinished in interface ICraftingNetworkcraftingJob - The crafting job.public boolean cancelCraftingJob(int channel,
int craftingJobId)
ICraftingNetworkcancelCraftingJob in interface ICraftingNetworkchannel - A channel id.craftingJobId - The crafting job id.protected void cancelCraftingJob(CraftingJob craftingJob)
public java.util.Iterator<CraftingJob> getCraftingJobs(int channel)
getCraftingJobs in interface ICraftingNetworkchannel - A channel id.@Nullable public CraftingJob getCraftingJob(int channel, int craftingJobId)
getCraftingJob in interface ICraftingNetworkchannel - A channel id.craftingJobId - A crafting job id.protected void addCraftingJob(int channel,
CraftingJob craftingJob,
ICraftingInterface craftingInterface)
protected void removeCraftingJob(int channel,
CraftingJob craftingJob)
public <T,M> java.util.Iterator<CraftingJob> getCraftingJobs(int channel, org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent, T instance, M matchCondition)
ICraftingNetworkgetCraftingJobs in interface ICraftingNetworkT - The instance type.M - The matching condition parameter.channel - The channel.ingredientComponent - The ingredient component of the given output type.instance - The expected output instance.matchCondition - The matching condition under which the instance should be matched.public CraftingJobDependencyGraph getCraftingJobDependencyGraph()
getCraftingJobDependencyGraph in interface ICraftingNetwork@Nullable public ICraftingInterface getCraftingJobInterface(int channel, int craftingJobId)
ICraftingNetworkgetCraftingJobInterface in interface ICraftingNetworkchannel - The channel.craftingJobId - A crafting job.public long getRunningTicks(CraftingJob craftingJob)
ICraftingNetworkgetRunningTicks in interface ICraftingNetworkcraftingJob - A crafting job.protected void cleanupChannelIfEmpty(int channel)