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

All Superinterfaces:
CommandStringDisplayable, Iterable<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<T>
Default interface for Registry based handlers as they can all remove recipes by ResourceLocation.
DocParam:
this craftingTable
  • Field Details

    • JSON_RECIPE_GSON

      static final com.google.gson.Gson JSON_RECIPE_GSON
  • 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: <item:minecraft:gold_ore>, result: <item:minecraft:cooked_porkchop>.registryName, experience: 0.35 as float, cookingtime:100 }
    • getRecipeByName

      default T getRecipeByName(String name)
    • getRecipesByOutput

      default List<T> getRecipesByOutput(IIngredient output)
    • getAllRecipes

      default List<T> getAllRecipes()
    • getRecipeMap

      default Map<net.minecraft.resources.ResourceLocation,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 <tag:items: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 <item:minecraft:iron_ingot>
    • removeByName

      @Deprecated(forRemoval=true) default void removeByName(String name)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Remove recipe based on Registry name
      Parameters:
      name - registry name of recipe to remove
      DocParam:
      name "minecraft:furnace"
    • 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";}
    • 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 Map<net.minecraft.resources.ResourceLocation,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
    • iterator

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