Interface IRecipeStorage

All Known Implementing Classes:
RecipeStorage

public interface IRecipeStorage
Interface which describes the RecipeStorage.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canFullFillRecipe(int qty, Map<ItemStorage,Integer> existingRequirements, @NotNull List<net.neoforged.neoforge.items.IItemHandler> citizen, @NotNull IBuilding building)
    Method to check if with the help of inventories this recipe can be fulfilled.
    boolean
    canFullFillRecipe(int qty, Map<ItemStorage,Integer> existingRequirements, @NotNull net.neoforged.neoforge.items.IItemHandler... inventories)
    Method to check if with the help of inventories this recipe can be fulfilled.
    default boolean
    fullfillRecipe(net.minecraft.world.level.Level world, List<net.neoforged.neoforge.items.IItemHandler> handlers)
    Check for space, remove items, and insert crafted items.
    default boolean
    fullfillRecipe(net.minecraft.world.level.storage.loot.LootParams context, List<net.neoforged.neoforge.items.IItemHandler> handlers)
    Check for space, remove items, and insert crafted items.
    default boolean
    fullFillRecipe(@NotNull net.minecraft.world.level.Level world, @NotNull net.neoforged.neoforge.items.IItemHandler... inventories)
     
    default boolean
    fullFillRecipe(@NotNull net.minecraft.world.level.storage.loot.LootParams context, @NotNull net.neoforged.neoforge.items.IItemHandler... inventories)
     
    default @Nullable List<net.minecraft.world.item.ItemStack>
    fullfillRecipeAndCopy(net.minecraft.world.level.Level world, List<net.neoforged.neoforge.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.neoforged.neoforge.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 getPrimaryOutput
    getClassicForMultiOutput(Predicate<net.minecraft.world.item.ItemStack> stackPredicate)
    Get the classic version of this recipe with GetPrimaryOutput targeted correctly from the chosen alternate
    getClassicForMultiOutput(net.minecraft.world.item.ItemStack requiredOutput)
    Get the classic version of this recipe with GetPrimaryOutput targeted correctly from the chosen alternate
    Get 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)
    int
    Get the grid size.
    Get the list of input items.
    net.minecraft.world.level.block.Block
    Get the required intermediate for the recipe.
    net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable>
    Get the location/id of the Loot table used for optional outputs
    net.minecraft.world.item.ItemStack
    Getter for the primary output.
    net.minecraft.resources.ResourceLocation
    Source of the recipe, ie registry name.
    Get which type this recipe is This type comes from the RecipeTypes registry
    Get the additional tool needed beyond the recipe (if any)
    List<net.minecraft.world.item.ItemStack>
    Get the secondary (leave behind in grid) outputs
    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.neoforged.neoforge.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.neoforged.neoforge.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.neoforged.neoforge.items.IItemHandler... inventories)
    • fullFillRecipe

      default boolean fullFillRecipe(@NotNull @NotNull net.minecraft.world.level.storage.loot.LootParams context, @NotNull @NotNull net.neoforged.neoforge.items.IItemHandler... inventories)
    • fullfillRecipe

      default boolean fullfillRecipe(net.minecraft.world.level.storage.loot.LootParams context, List<net.neoforged.neoforge.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.neoforged.neoforge.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.neoforged.neoforge.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 context
      handlers - 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.neoforged.neoforge.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

      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

      RecipeStorage getClassicForMultiOutput(net.minecraft.world.item.ItemStack requiredOutput)
      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.ResourceKey<net.minecraft.world.level.storage.loot.LootTable> 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.