Interface ITerminalStorageTabIngredientCraftingHandler<O extends ITerminalCraftingOption<?>,I>
- Type Parameters:
O- The type of crafting option.I- The type of crafting plan identifier.
- All Known Implementing Classes:
TerminalStorageTabIngredientCraftingHandlerCraftingNetwork
public interface ITerminalStorageTabIngredientCraftingHandler<O extends ITerminalCraftingOption<?>,I>
Handles crafting actions inside ingredient-based terminal storage tabs.
-
Method Summary
Modifier and TypeMethodDescriptioncalculateCraftingPlan(org.cyclops.integrateddynamics.api.network.INetwork network, int channel, ITerminalCraftingOption craftingOption, long quantity) Calculate a crafting plan for the given crafting option.booleancancelCraftingJob(org.cyclops.integrateddynamics.api.network.INetwork network, int channel, I craftingJobId) Cancel the crafting job with the given id.deserializeCraftingJobId(net.minecraft.nbt.Tag tag) Deserialize a crafting job id.<T,M> O deserializeCraftingOption(org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T, M> ingredientComponent, net.minecraft.nbt.CompoundTag tag) Deserialize a crafting option from NBT.default ITerminalCraftingPlan<I>deserializeCraftingPlan(net.minecraft.nbt.CompoundTag tag) Deserialize a crafting plan from NBT.default ITerminalCraftingPlanFlat<I>deserializeCraftingPlanFlat(net.minecraft.nbt.CompoundTag tag) Deserialize a flat crafting plan from NBT.<T,M> int[] getCraftingJob(org.cyclops.integrateddynamics.api.network.INetwork network, int channel, I craftingJobId) Get the crafting job with the given id.getCraftingJobs(org.cyclops.integrateddynamics.api.network.INetwork network, int channel) <T,M> Collection<O> getCraftingOptions(TerminalStorageTabIngredientComponentServer<T, M> tab, int channel) Get all crafting options in the given tab.net.minecraft.resources.ResourceLocationgetId()net.minecraft.nbt.TagSerializes a crafting job id.net.minecraft.nbt.CompoundTagserializeCraftingOption(O craftingOption) Serialize a crafting option to NBT.default net.minecraft.nbt.CompoundTagserializeCraftingPlan(ITerminalCraftingPlan<I> craftingPlan) Serialize a crafting plan to NBT.default net.minecraft.nbt.CompoundTagserializeCraftingPlanFlat(ITerminalCraftingPlanFlat<I> craftingPlan) Serialize a flat crafting plan to NBT.voidstartCraftingJob(org.cyclops.integrateddynamics.api.network.INetwork network, int channel, ITerminalCraftingPlan<I> craftingPlan, net.minecraft.server.level.ServerPlayer player) Start a crafting job.
-
Method Details
-
getId
net.minecraft.resources.ResourceLocation getId()- Returns:
- The unique id of this handler.
-
getChannels
- Type Parameters:
T- The instance type.M- The matching condition parameter.- Parameters:
tab- An ingredient tab.- Returns:
- All channels that have crafting options.
-
getCraftingOptions
<T,M> Collection<O> getCraftingOptions(TerminalStorageTabIngredientComponentServer<T, M> tab, int channel) Get all crafting options in the given tab.- Type Parameters:
T- The instance type.M- The matching condition parameter.- Parameters:
tab- An ingredient tab.channel- The channel to get the options for.- Returns:
- Crafting options.
-
serializeCraftingOption
Serialize a crafting option to NBT.- Parameters:
craftingOption- A crafting option.- Returns:
- An NBT tag.
-
deserializeCraftingOption
<T,M> O deserializeCraftingOption(org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T, M> ingredientComponent, net.minecraft.nbt.CompoundTag tag) throws IllegalArgumentExceptionDeserialize a crafting option from NBT.- Type Parameters:
T- The instance type.M- The matching condition parameter.- Parameters:
ingredientComponent- The ingredient component for the crafting option.tag- An NBT tag representing a crafting option.- Returns:
- A crafting option.
- Throws:
IllegalArgumentException- If the given tag was invalid.
-
calculateCraftingPlan
ITerminalCraftingPlan<I> calculateCraftingPlan(org.cyclops.integrateddynamics.api.network.INetwork network, int channel, ITerminalCraftingOption craftingOption, long quantity) Calculate a crafting plan for the given crafting option.- Parameters:
network- The network in which the plan should be calculated.channel- The channel to get the options for.craftingOption- A crafting option.quantity- The requested output quantity.- Returns:
- The calculated crafting plan.
-
serializeCraftingPlan
Serialize a crafting plan to NBT.- Parameters:
craftingPlan- A crafting plan.- Returns:
- An NBT tag.
-
deserializeCraftingPlan
default ITerminalCraftingPlan<I> deserializeCraftingPlan(net.minecraft.nbt.CompoundTag tag) throws IllegalArgumentException Deserialize a crafting plan from NBT.- Parameters:
tag- An NBT tag representing a crafting plan.- Returns:
- A crafting option.
- Throws:
IllegalArgumentException- If the given tag was invalid.
-
serializeCraftingPlanFlat
default net.minecraft.nbt.CompoundTag serializeCraftingPlanFlat(ITerminalCraftingPlanFlat<I> craftingPlan) Serialize a flat crafting plan to NBT.- Parameters:
craftingPlan- A flat crafting plan.- Returns:
- An NBT tag.
-
deserializeCraftingPlanFlat
default ITerminalCraftingPlanFlat<I> deserializeCraftingPlanFlat(net.minecraft.nbt.CompoundTag tag) throws IllegalArgumentException Deserialize a flat crafting plan from NBT.- Parameters:
tag- An NBT tag representing a flat crafting plan.- Returns:
- A crafting option.
- Throws:
IllegalArgumentException- If the given tag was invalid.
-
serializeCraftingJobId
Serializes a crafting job id.- Parameters:
id- An id.- Returns:
- An NBT tag.
-
deserializeCraftingJobId
Deserialize a crafting job id.- Parameters:
tag- An NBT tag.- Returns:
- An id.
-
startCraftingJob
void startCraftingJob(org.cyclops.integrateddynamics.api.network.INetwork network, int channel, ITerminalCraftingPlan<I> craftingPlan, net.minecraft.server.level.ServerPlayer player) throws CraftingJobStartException Start a crafting job.- Parameters:
network- The network in which the plan should be started.channel- The channel to get the options for.craftingPlan- A crafting plan.player- The player that started the crafting job.- Throws:
CraftingJobStartException- If the crafting job failed to start.
-
getCraftingJobs
List<ITerminalCraftingPlan<I>> getCraftingJobs(org.cyclops.integrateddynamics.api.network.INetwork network, int channel) - Parameters:
network- The network in which the plan should be started.channel- The channel to get the options for.- Returns:
- All running crafting plans.
-
getCraftingJob
@Nullable ITerminalCraftingPlan<I> getCraftingJob(org.cyclops.integrateddynamics.api.network.INetwork network, int channel, I craftingJobId) Get the crafting job with the given id.- Parameters:
network- The network in which the plan should be started.channel- The channel to get the options for.craftingJobId- A crafting job id.- Returns:
- A crafting job or null.
-
cancelCraftingJob
boolean cancelCraftingJob(org.cyclops.integrateddynamics.api.network.INetwork network, int channel, I craftingJobId) Cancel the crafting job with the given id.- Parameters:
network- The network in which the plan should be started.channel- The channel to get the options for.craftingJobId- A crafting job id.- Returns:
- If the crafting job was successfully cancelled.
-