Class GenericRecipesManager
java.lang.Object
com.blamejared.crafttweaker.api.recipe.manager.GenericRecipesManager
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 -
Method Summary
Modifier and TypeMethodDescriptionvoidaddJsonRecipe(String name, MapData data) Add a new recipe based on the given recipe in a valid DataPack JSON format.List<IRecipeManager<?>> 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>> getRecipeByName(String name) 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>>> getRecipesByOutput(IIngredient output) 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) voidremove(IIngredient output) Removes recipes by outputvoidRemoves all recipes from all managers.voidremoveByInput(IItemStack input) Removes all recipes where the input contains the given IItemStack.voidremoveByModid(String modId) Removes all recipes from the provided mod.voidremoveByModid(String modId, Predicate<String> exclude) Removes all recipes from the provided mod.voidremoveByName(String... names) Remove recipes based on Registry namesvoidremoveByRegex(String regex) Remove recipe based on regexvoidremoveMatching(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
-
Field Details
-
INSTANCE
-
-
Method Details
-
addJsonRecipe
Add a new recipe based on the given recipe in a valid DataPack JSON format.Unlike the addJSONRecipe method in
IRecipeManageryou **must** set the type of the recipe within the JSON yourself.- Parameters:
name- The recipe's resource pathdata- 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
-
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
Removes recipes by output- Parameters:
output- The recipe result- DocParam:
- output invalid input: '<'item:minecraft:iron_ingot>
-
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
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
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 modidexclude- Function that returns `true` if the recipe should remain in the registry.- DocParam:
- modId "minecraft", exclude (recipeName as string) => recipeName == "white_bed"
-
removeByRegex
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 ofnet.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
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.
-