Class GenericRecipesManager

java.lang.Object
com.blamejared.crafttweaker.api.recipe.manager.GenericRecipesManager

@ZenRegister public class GenericRecipesManager extends Object
This recipe manager allows you to perform removal actions over all recipe managers. You can access this manager by using the `recipes` global keyword.
DocParam:
this recipes
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Add a new recipe based on the given recipe in a valid DataPack JSON format.
    Returns a list of all known recipe managers.
    List<net.minecraft.world.item.crafting.RecipeHolder<net.minecraft.world.item.crafting.Recipe<net.minecraft.world.item.crafting.RecipeInput>>>
     
    List<net.minecraft.world.item.crafting.RecipeHolder<?>>
     
    net.minecraft.world.item.crafting.RecipeHolder<net.minecraft.world.item.crafting.Recipe<net.minecraft.world.item.crafting.RecipeInput>>
     
    Map<net.minecraft.resources.ResourceLocation,net.minecraft.world.item.crafting.RecipeHolder<net.minecraft.world.item.crafting.Recipe<net.minecraft.world.item.crafting.RecipeInput>>>
    Returns a map of all known recipes.
    List<net.minecraft.world.item.crafting.RecipeHolder<net.minecraft.world.item.crafting.Recipe<net.minecraft.world.item.crafting.RecipeInput>>>
     
    List<net.minecraft.world.item.crafting.RecipeHolder<net.minecraft.world.item.crafting.Recipe<net.minecraft.world.item.crafting.RecipeInput>>>
    getRecipesMatching(Predicate<net.minecraft.world.item.crafting.RecipeHolder<net.minecraft.world.item.crafting.Recipe<net.minecraft.world.item.crafting.RecipeInput>>> predicate)
     
    void
    Removes recipes by output
    void
    Removes all recipes from all managers.
    void
    Removes all recipes where the input contains the given IItemStack.
    void
    Removes all recipes from the provided mod.
    void
    Removes all recipes from the provided mod.
    void
    removeByName(String... names)
    Remove recipes based on Registry names
    void
    Remove recipe based on regex
    void
    removeMatching(Predicate<net.minecraft.world.item.crafting.RecipeHolder<net.minecraft.world.item.crafting.Recipe<net.minecraft.world.item.crafting.RecipeInput>>> predicate)
    Removes all recipes that match the given predicate

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • addJsonRecipe

      public void addJsonRecipe(String name, MapData data)
      Add a new recipe based on the given recipe in a valid DataPack JSON format.

      Unlike the addJSONRecipe method in IRecipeManager you **must** set the type of the recipe within the JSON yourself.

      Parameters:
      name - The recipe's resource path
      data - The recipe in JSON format
      DocParam:
      name "recipe_name", data { type: "minecraft:smoking", ingredient: invalid input: '<'item:minecraft:gold_ore>, result: invalid input: '<'item:minecraft:cooked_porkchop>, experience: 0.35 as float, cookingtime: 100 }
    • getRecipeByName

      public net.minecraft.world.item.crafting.RecipeHolder<net.minecraft.world.item.crafting.Recipe<net.minecraft.world.item.crafting.RecipeInput>> getRecipeByName(String name)
    • getRecipesByOutput

      public List<net.minecraft.world.item.crafting.RecipeHolder<net.minecraft.world.item.crafting.Recipe<net.minecraft.world.item.crafting.RecipeInput>>> getRecipesByOutput(IIngredient output)
    • getRecipesMatching

      public List<net.minecraft.world.item.crafting.RecipeHolder<net.minecraft.world.item.crafting.Recipe<net.minecraft.world.item.crafting.RecipeInput>>> getRecipesMatching(Predicate<net.minecraft.world.item.crafting.RecipeHolder<net.minecraft.world.item.crafting.Recipe<net.minecraft.world.item.crafting.RecipeInput>>> predicate)
    • getAllRecipes

      public List<net.minecraft.world.item.crafting.RecipeHolder<net.minecraft.world.item.crafting.Recipe<net.minecraft.world.item.crafting.RecipeInput>>> getAllRecipes()
    • getAllRecipesRaw

      public List<net.minecraft.world.item.crafting.RecipeHolder<?>> getAllRecipesRaw()
    • getRecipeMap

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

      public void remove(IIngredient output)
      Removes recipes by output
      Parameters:
      output - The recipe result
      DocParam:
      output invalid input: '<'item:minecraft:iron_ingot>
    • removeByInput

      public 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

      public 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

      public void removeByModid(String modId)
      Removes all recipes from the provided mod. Chooses the recipes based on their full recipe name, not based on output item!
      Parameters:
      modId - The mod's modId
      DocParam:
      modId "crafttweaker"
    • removeByModid

      public void removeByModid(String modId, Predicate<String> exclude)
      Removes all recipes from the provided mod. Allows a function to exclude certain recipe names from being removed. In the example below, only the recipe for the white bed would remain. Since the recipe's namespace is already fixed based on the modId argument, the recipe filter will only check the resource path!
      Parameters:
      modId - The mod's modid
      exclude - Function that returns `true` if the recipe should remain in the registry.
      DocParam:
      modId "minecraft", exclude (recipeName as string) => recipeName == "white_bed"
    • removeByRegex

      public void removeByRegex(String regex)
      Remove recipe based on regex
      Parameters:
      regex - regex to match against
      DocParam:
      regex "\\d_\\d"
    • removeMatching

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

      public void removeAll()
      Removes all recipes from all managers.
    • getAllManagers

      public List<IRecipeManager<?>> getAllManagers()
      Returns a list of all known recipe managers. This includes managers added by mod integrations as well as wrapper managers added to provide simple support.