Package com.minecolonies.api.crafting
Interface IRecipeStorage
- All Known Implementing Classes:
RecipeStorage
public interface IRecipeStorage
Interface which describes the RecipeStorage.
-
Method Summary
Modifier and TypeMethodDescriptionbooleancanFullFillRecipe(int qty, Map<ItemStorage, Integer> existingRequirements, @NotNull List<net.minecraftforge.items.IItemHandler> citizen, @NotNull IBuilding building) Method to check if with the help of inventories this recipe can be fulfilled.booleancanFullFillRecipe(int qty, Map<ItemStorage, Integer> existingRequirements, @NotNull net.minecraftforge.items.IItemHandler... inventories) Method to check if with the help of inventories this recipe can be fulfilled.default booleanfullfillRecipe(net.minecraft.world.level.Level world, List<net.minecraftforge.items.IItemHandler> handlers) Check for space, remove items, and insert crafted items.default booleanfullfillRecipe(net.minecraft.world.level.storage.loot.LootParams context, List<net.minecraftforge.items.IItemHandler> handlers) Check for space, remove items, and insert crafted items.default booleanfullFillRecipe(@NotNull net.minecraft.world.level.Level world, @NotNull net.minecraftforge.items.IItemHandler... inventories) default booleanfullFillRecipe(@NotNull net.minecraft.world.level.storage.loot.LootParams context, @NotNull net.minecraftforge.items.IItemHandler... inventories) default @Nullable List<net.minecraft.world.item.ItemStack>fullfillRecipeAndCopy(net.minecraft.world.level.Level world, List<net.minecraftforge.items.IItemHandler> handlers, boolean doInsert) Check for space, remove items, and insert crafted items.@Nullable List<net.minecraft.world.item.ItemStack>fullfillRecipeAndCopy(net.minecraft.world.level.storage.loot.LootParams context, List<net.minecraftforge.items.IItemHandler> handlers, boolean doInsert) Check for space, remove items, and possibly insert crafted items, returning a copy of the crafted items.List<net.minecraft.world.item.ItemStack>Get a list of alternates to getPrimaryOutputgetClassicForMultiOutput(Predicate<net.minecraft.world.item.ItemStack> stackPredicate) Get the classic version of this recipe with GetPrimaryOutput targeted correctly from the chosen alternategetClassicForMultiOutput(net.minecraft.world.item.ItemStack requiredOutput) Get the classic version of this recipe with GetPrimaryOutput targeted correctly from the chosen alternateGet the cleaned up list of the recipes.List<net.minecraft.world.item.ItemStack>Get the tools (leave behind in grid)List<net.minecraft.world.item.ItemStack>Get the tools and Secondary Output (leave behind in grid)intGet the grid size.getInput()Get the list of input items.net.minecraft.world.level.block.BlockGet the required intermediate for the recipe.net.minecraft.resources.ResourceLocationGet the location/id of the Loot table used for optional outputsnet.minecraft.world.item.ItemStackGetter for the primary output.net.minecraft.resources.ResourceLocationSource of the recipe, ie registry name.Get which type this recipe is This type comes from the RecipeTypes registryGet the additional tool needed beyond the recipe (if any)List<net.minecraft.world.item.ItemStack>Get the secondary (leave behind in grid) outputsIToken<?>getToken()Get the unique token of the recipe.
-
Method Details
-
getInput
List<ItemStorage> getInput()Get the list of input items. Suppressing Sonar Rule Squid:S2384 The rule thinks we should return a copy of the list and not the list itself. But in this case the rule does not apply because the list is an unmodifiable list already- Returns:
- the list.
-
getCleanedInput
List<ItemStorage> getCleanedInput()Get the cleaned up list of the recipes. Air gets removed and equal items get put together. This returns an list of immutable itemStorage elements that cannot be tempered with.- Returns:
- the list.
-
getPrimaryOutput
net.minecraft.world.item.ItemStack getPrimaryOutput()Getter for the primary output.- Returns:
- the itemStack to be produced.
-
getGridSize
int getGridSize()Get the grid size.- Returns:
- the integer representing it. (2x2 = 4, 3x3 = 9, etc)
-
getIntermediate
net.minecraft.world.level.block.Block getIntermediate()Get the required intermediate for the recipe.- Returns:
- the block.
-
canFullFillRecipe
boolean canFullFillRecipe(int qty, Map<ItemStorage, Integer> existingRequirements, @NotNull @NotNull net.minecraftforge.items.IItemHandler... inventories) Method to check if with the help of inventories this recipe can be fulfilled. Also check if the inventory has enough to fulfill the existing requirements.- Parameters:
qty- the quantity to craft.existingRequirements- map of existing requirements (pending requests).inventories- the inventories to check.- Returns:
- true if possible, else false.
-
canFullFillRecipe
boolean canFullFillRecipe(int qty, Map<ItemStorage, Integer> existingRequirements, @NotNull @NotNull List<net.minecraftforge.items.IItemHandler> citizen, @NotNull @NotNull IBuilding building) Method to check if with the help of inventories this recipe can be fulfilled. Also check if the inventory has enough to fulfill the existing requirements.- Parameters:
qty- the quantity to craft.existingRequirements- map of existing requirements (pending requests).citizen- the citizen inventory to check.building- the building inv to check.- Returns:
- true if possible, else false.
-
fullFillRecipe
default boolean fullFillRecipe(@NotNull @NotNull net.minecraft.world.level.Level world, @NotNull @NotNull net.minecraftforge.items.IItemHandler... inventories) -
fullFillRecipe
default boolean fullFillRecipe(@NotNull @NotNull net.minecraft.world.level.storage.loot.LootParams context, @NotNull @NotNull net.minecraftforge.items.IItemHandler... inventories) -
fullfillRecipe
default boolean fullfillRecipe(net.minecraft.world.level.storage.loot.LootParams context, List<net.minecraftforge.items.IItemHandler> handlers) Check for space, remove items, and insert crafted items.- Parameters:
handlers- the handlers to use.- Returns:
- true if successful.
-
fullfillRecipe
default boolean fullfillRecipe(net.minecraft.world.level.Level world, List<net.minecraftforge.items.IItemHandler> handlers) Check for space, remove items, and insert crafted items.- Parameters:
handlers- the handlers to use.- Returns:
- true if successful.
-
fullfillRecipeAndCopy
@Nullable @Nullable List<net.minecraft.world.item.ItemStack> fullfillRecipeAndCopy(net.minecraft.world.level.storage.loot.LootParams context, List<net.minecraftforge.items.IItemHandler> handlers, boolean doInsert) Check for space, remove items, and possibly insert crafted items, returning a copy of the crafted items.- Parameters:
context- loot contexthandlers- the handlers to use- Returns:
- copy of the crafted items if successful, null on failure
-
fullfillRecipeAndCopy
@Nullable default @Nullable List<net.minecraft.world.item.ItemStack> fullfillRecipeAndCopy(net.minecraft.world.level.Level world, List<net.minecraftforge.items.IItemHandler> handlers, boolean doInsert) Check for space, remove items, and insert crafted items.- Parameters:
handlers- the handlers to use.- Returns:
- true if successful.
-
getRecipeType
AbstractRecipeType<IRecipeStorage> getRecipeType()Get which type this recipe is This type comes from the RecipeTypes registry- Returns:
- The recipe type
-
getAlternateOutputs
List<net.minecraft.world.item.ItemStack> getAlternateOutputs()Get a list of alternates to getPrimaryOutput- Returns:
- a list if Itemstacks that this recipe can produce instead of getPrimaryOutput
-
getClassicForMultiOutput
Get the classic version of this recipe with GetPrimaryOutput targeted correctly from the chosen alternate- Parameters:
requiredOutput- Which output wanted- Returns:
- the RecipeStorage that is "right" for that output
-
getClassicForMultiOutput
RecipeStorage getClassicForMultiOutput(Predicate<net.minecraft.world.item.ItemStack> stackPredicate) Get the classic version of this recipe with GetPrimaryOutput targeted correctly from the chosen alternate- Parameters:
stackPredicate- Predicate to select the right stack- Returns:
- the RecipeStorage that is "right" for that output
-
getRecipeSource
net.minecraft.resources.ResourceLocation getRecipeSource()Source of the recipe, ie registry name.- Returns:
-
getSecondaryOutputs
List<net.minecraft.world.item.ItemStack> getSecondaryOutputs()Get the secondary (leave behind in grid) outputs- Returns:
- list of items that weren't consumed during crafting
-
getCraftingToolsAndSecondaryOutputs
List<net.minecraft.world.item.ItemStack> getCraftingToolsAndSecondaryOutputs()Get the tools and Secondary Output (leave behind in grid)- Returns:
- list of items that weren't consumed during crafting
-
getCraftingTools
List<net.minecraft.world.item.ItemStack> getCraftingTools()Get the tools (leave behind in grid)- Returns:
- list of items that weren't consumed during crafting
-
getRequiredTool
EquipmentTypeEntry getRequiredTool()Get the additional tool needed beyond the recipe (if any)- Returns:
- the required tool
-
getLootTable
net.minecraft.resources.ResourceLocation getLootTable()Get the location/id of the Loot table used for optional outputs- Returns:
- the resource location for the table
-
getToken
IToken<?> getToken()Get the unique token of the recipe.- Returns:
- the IToken.
-