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 TypeMethodDescriptiondefault voidaddJsonRecipe(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 aRecipeHolderto hold the given recipe.default net.minecraft.resources.ResourceLocationfixRecipeId(String name) Create a newResourceLocationfrom 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.ResourceLocationfixRecipeId(String name, Function<String, net.minecraft.resources.ResourceLocation> idMaker) Create a newResourceLocationfrom the given name, the name is checked for common errors that are often ran into with recipe names, and logs them.default StringfixRecipeName(String name) Fixes and logs some common errors that people run into with recipe namesdefault net.minecraft.resources.ResourceLocationGets the resource location to get this Recipe handler Default just looks up the Recipe Type key from the registrydefault StringReturns the BEP to get this thingydefault net.minecraft.world.item.crafting.RecipeHolder<T> getRecipeByName(String name) default RecipeList<T> Gets aRecipeListwhich 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.getRecipesByOutput(IIngredient output) 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.iterator()default voidremove(IIngredient output) Remove a recipe based on it's output.default voidRemove all recipes in this registrydefault voidremoveByInput(IItemStack input) Removes all recipes where the input contains the given IItemStack.default voidremoveByModid(String modid, Predicate<String> exclude) Remove recipe based on Registry name modiddefault voidremoveByName(String... names) Remove recipes based on Registry namesdefault voidremoveByRegex(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.default voidremoveMatching(Predicate<net.minecraft.world.item.crafting.RecipeHolder<T>> predicate) Removes all recipes that match the given predicateMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
addJsonRecipe
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 recipemapData- 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
-
getRecipesByOutput
default List<net.minecraft.world.item.crafting.RecipeHolder<T>> getRecipesByOutput(IIngredient output) -
getRecipesMatching
-
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
Remove a recipe based on it's output.- Parameters:
output- output of the recipe- DocParam:
- output invalid input: '<'tag:item:minecraft:wool>
-
removeByInput
Removes all recipes where the input contains the given IItemStack.- Parameters:
input- The input IItemStack.- DocParam:
- input invalid input: '<'item:minecraft:iron_ingot>
-
removeByName
Remove recipes based on Registry names- Parameters:
names- registry names of recipes to remove- DocParam:
- name "minecraft:furnace", "minecraft:bow"
-
removeByModid
Remove recipe based on Registry name modid- Parameters:
modid- modid of the recipes to remove- DocParam:
- modid "minecraft"
-
removeByRegex
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
Removes all recipes that match the given predicate- Parameters:
predicate- a predicate ofnet.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
Gets aRecipeListwhich can be used to change recipes for this manager. Changes made through aRecipeListare applied to all the places that vanilla keeps track of recipes.- Returns:
- A
RecipeListfor this manager.
-
getRecipes
Gets the recipes for this RecipeManager. This should only be used to view recipes, if you need to change the map, usegetRecipeList()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
Description copied from interface:CommandStringDisplayableReturns the BEP to get this thingy- Specified by:
getCommandStringin interfaceCommandStringDisplayable
-
fixRecipeName
Fixes and logs some common errors that people run into with recipe names- Parameters:
name- name to check- Returns:
- fixed name
-
fixRecipeId
Create a newResourceLocationfrom 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 newResourceLocationfrom 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 checkidMaker- a function to create aResourceLocationfrom 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 aRecipeHolderto hold the given recipe.- Parameters:
id- The id of the reciperecipe- The recipe to hold- Returns:
- a new
RecipeHolder
-
iterator
-