Interface IRecipeManager<T extends net.minecraft.world.item.crafting.Recipe<?>>

All Superinterfaces:
CommandStringDisplayable, Iterable<net.minecraft.world.item.crafting.RecipeHolder<T>>
All Known Subinterfaces:
ICookingRecipeManager<T>
All Known Implementing Classes:
BlastFurnaceRecipeManager, CampFireRecipeManager, CraftingTableRecipeManager, FurnaceRecipeManager, RecipeManagerWrapper, SmithingRecipeManager, SmokerRecipeManager, StoneCutterManager

@ZenRegister public interface IRecipeManager<T extends net.minecraft.world.item.crafting.Recipe<?>> extends CommandStringDisplayable, Iterable<net.minecraft.world.item.crafting.RecipeHolder<T>>
Default interface for Registry based handlers as they can all remove recipes by ResourceLocation.
DocParam:
this craftingTable
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    addJsonRecipe(String name, MapData mapData)
    Adds a recipe based on a provided IData.
    default net.minecraft.world.item.crafting.RecipeHolder<T>
    createHolder(net.minecraft.resources.ResourceLocation id, T recipe)
    Creates a RecipeHolder to hold the given recipe.
    default net.minecraft.resources.ResourceLocation
    Create a new ResourceLocation from the given name, the name is checked for common errors that are often ran into with recipe names, and logs them.
    default net.minecraft.resources.ResourceLocation
    fixRecipeId(String name, Function<String,net.minecraft.resources.ResourceLocation> idMaker)
    Create a new ResourceLocation from the given name, the name is checked for common errors that are often ran into with recipe names, and logs them.
    default String
    Fixes and logs some common errors that people run into with recipe names
    default List<net.minecraft.world.item.crafting.RecipeHolder<T>>
     
    default net.minecraft.resources.ResourceLocation
    Gets the resource location to get this Recipe handler Default just looks up the Recipe Type key from the registry
    default String
    Returns the BEP to get this thingy
    default net.minecraft.world.item.crafting.RecipeHolder<T>
     
    default RecipeList<T>
    Gets a RecipeList which can be used to change recipes for this manager.
    default Map<net.minecraft.resources.ResourceLocation,net.minecraft.world.item.crafting.RecipeHolder<T>>
    Returns a map of all known recipes.
    default Collection<net.minecraft.world.item.crafting.RecipeHolder<T>>
    Gets the recipes for this RecipeManager.
    default List<net.minecraft.world.item.crafting.RecipeHolder<T>>
     
    default List<net.minecraft.world.item.crafting.RecipeHolder<T>>
    getRecipesMatching(Predicate<net.minecraft.world.item.crafting.RecipeHolder<T>> predicate)
     
    net.minecraft.world.item.crafting.RecipeType<T>
    Gets the recipe type for the registry to remove from.
    default @NotNull Iterator<net.minecraft.world.item.crafting.RecipeHolder<T>>
     
    default void
    Remove a recipe based on it's output.
    default void
    Remove all recipes in this registry
    default void
    Removes all recipes where the input contains the given IItemStack.
    default void
    Remove recipe based on Registry name modid
    default void
    removeByName(String... names)
    Remove recipes based on Registry names
    default void
    Remove recipe based on regex with an added exclusion check, so you can remove the whole mod besides a few specified.
    default void
    removeMatching(Predicate<net.minecraft.world.item.crafting.RecipeHolder<T>> predicate)
    Removes all recipes that match the given predicate

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Method Details

    • addJsonRecipe

      default void addJsonRecipe(String name, MapData mapData)
      Adds a recipe based on a provided IData. The provided IData should represent a DataPack json, this effectively allows you to register recipes for any DataPack supporting RecipeType systems.
      Parameters:
      name - name of the recipe
      mapData - data representing the json file
      DocParam:
      name "recipe_name", mapData { ingredient: invalid input: '<'item:minecraft:gold_ore>, result: invalid input: '<'item:minecraft:cooked_porkchop>.registryName, experience: 0.35 as float, cookingtime:100 }
    • getRecipeByName

      default net.minecraft.world.item.crafting.RecipeHolder<T> getRecipeByName(String name)
    • getRecipesByOutput

      default List<net.minecraft.world.item.crafting.RecipeHolder<T>> getRecipesByOutput(IIngredient output)
    • getRecipesMatching

      default List<net.minecraft.world.item.crafting.RecipeHolder<T>> getRecipesMatching(Predicate<net.minecraft.world.item.crafting.RecipeHolder<T>> predicate)
    • getAllRecipes

      default List<net.minecraft.world.item.crafting.RecipeHolder<T>> getAllRecipes()
    • getRecipeMap

      default Map<net.minecraft.resources.ResourceLocation,net.minecraft.world.item.crafting.RecipeHolder<T>> getRecipeMap()
      Returns a map of all known recipes.
      Returns:
      A Map of recipe name to recipe of all known recipes.
    • remove

      default void remove(IIngredient output)
      Remove a recipe based on it's output.
      Parameters:
      output - output of the recipe
      DocParam:
      output invalid input: '<'tag:item:minecraft:wool>
    • removeByInput

      default void removeByInput(IItemStack input)
      Removes all recipes where the input contains the given IItemStack.
      Parameters:
      input - The input IItemStack.
      DocParam:
      input invalid input: '<'item:minecraft:iron_ingot>
    • removeByName

      default void removeByName(String... names)
      Remove recipes based on Registry names
      Parameters:
      names - registry names of recipes to remove
      DocParam:
      name "minecraft:furnace", "minecraft:bow"
    • removeByModid

      default void removeByModid(String modid, Predicate<String> exclude)
      Remove recipe based on Registry name modid
      Parameters:
      modid - modid of the recipes to remove
      DocParam:
      modid "minecraft"
    • removeByRegex

      default void removeByRegex(String regex, Predicate<String> exclude)
      Remove recipe based on regex with an added exclusion check, so you can remove the whole mod besides a few specified.
      Parameters:
      regex - regex to match against
      DocParam:
      regex "\\d_\\d", exclude (name as string) => {return name == "orange_wool";}
    • removeMatching

      default void removeMatching(Predicate<net.minecraft.world.item.crafting.RecipeHolder<T>> predicate)
      Removes all recipes that match the given predicate
      Parameters:
      predicate - a predicate of net.minecraft.world.item.crafting.RecipeHolder<T extends net.minecraft.world.item.crafting.Recipe<?>> to test recipes against.
      DocParam:
      predicate (holder) => "wool" in holder.id.path
    • removeAll

      default void removeAll()
      Remove all recipes in this registry
    • getRecipeType

      net.minecraft.world.item.crafting.RecipeType<T> getRecipeType()
      Gets the recipe type for the registry to remove from.
      Returns:
      IRecipeType of this registry.
    • getRecipeList

      default RecipeList<T> getRecipeList()
      Gets a RecipeList which can be used to change recipes for this manager. Changes made through a RecipeList are applied to all the places that vanilla keeps track of recipes.
      Returns:
      A RecipeList for this manager.
    • getRecipes

      default Collection<net.minecraft.world.item.crafting.RecipeHolder<T>> getRecipes()
      Gets the recipes for this RecipeManager. This should only be used to view recipes, if you need to change the map, use getRecipeList() In the future this method will either be removed or made to return an immutable map.
      Returns:
      A map of name to recipe for the manager type.
    • getBracketResourceLocation

      default net.minecraft.resources.ResourceLocation getBracketResourceLocation()
      Gets the resource location to get this Recipe handler Default just looks up the Recipe Type key from the registry
    • getCommandString

      default String getCommandString()
      Description copied from interface: CommandStringDisplayable
      Returns the BEP to get this thingy
      Specified by:
      getCommandString in interface CommandStringDisplayable
    • fixRecipeName

      default String fixRecipeName(String name)
      Fixes and logs some common errors that people run into with recipe names
      Parameters:
      name - name to check
      Returns:
      fixed name
    • fixRecipeId

      default net.minecraft.resources.ResourceLocation fixRecipeId(String name)
      Create a new ResourceLocation from the given name, the name is checked for common errors that are often ran into with recipe names, and logs them.

      NOTE: The returned location is under the "crafttweaker" namespace

      Parameters:
      name - name to check
      Returns:
      fixed name
      Since:
      15.0.0
    • fixRecipeId

      default net.minecraft.resources.ResourceLocation fixRecipeId(String name, Function<String,net.minecraft.resources.ResourceLocation> idMaker)
      Create a new ResourceLocation from the given name, the name is checked for common errors that are often ran into with recipe names, and logs them.
      Parameters:
      name - name to check
      idMaker - a function to create a ResourceLocation from the name
      Returns:
      fixed name
      Since:
      15.0.0
    • createHolder

      default net.minecraft.world.item.crafting.RecipeHolder<T> createHolder(net.minecraft.resources.ResourceLocation id, T recipe)
      Creates a RecipeHolder to hold the given recipe.
      Parameters:
      id - The id of the recipe
      recipe - The recipe to hold
      Returns:
      a new RecipeHolder
    • iterator

      @NotNull default @NotNull Iterator<net.minecraft.world.item.crafting.RecipeHolder<T>> iterator()
      Specified by:
      iterator in interface Iterable<T extends net.minecraft.world.item.crafting.Recipe<?>>