Class RecipeList<T extends net.minecraft.world.item.crafting.Recipe<?>>
java.lang.Object
com.blamejared.crafttweaker.api.recipe.RecipeList<T>
- Type Parameters:
T- The base type ofRecipein this list.
This class acts as a wrapper for the (currently) two recipe maps that vanilla stores recipes in:
The
recipes map, which is used for actual recipe lookups.
The byName map, which is used when you have a recipe id, and want to get the recipe for that id, such as in the recipe book.-
Constructor Summary
ConstructorsConstructorDescriptionRecipeList(net.minecraft.world.item.crafting.RecipeType<T> recipeType, Map<net.minecraft.resources.ResourceLocation, T> recipes, Map<net.minecraft.resources.ResourceLocation, net.minecraft.world.item.crafting.Recipe<?>> byName) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the given recipe to this list.Gets a recipe based on the given Id.get(net.minecraft.resources.ResourceLocation id) Gets a recipe based on the given Id.Gets a view of the recipes in this RecipeList.Map<net.minecraft.resources.ResourceLocation,net.minecraft.world.item.crafting.Recipe<?>> Gets an unmodifiable view of the byName map in this list.Gets an unmodifiable view of the recipe map in this list.getRecipesByOutput(IIngredient output) Gets recipes based on the output item, checked against the given IIngredient.net.minecraft.world.item.crafting.RecipeType<T>Gets the recipe type that this list deals with.intgetSize()Gets how many recipes are in this list.booleanChecks if this list contains a recipe with the given key.booleanhas(net.minecraft.resources.ResourceLocation id) Checks if this list contains a recipe with the given key.voidremove(net.minecraft.resources.ResourceLocation id) Remove the recipe with the given Id.voidRemoves all recipes in this list.voidremoveByIdTest(Predicate<net.minecraft.resources.ResourceLocation> idPredicate) Removes recipes that pass the given id Predicate.voidremoveByIdTest(Predicate<net.minecraft.resources.ResourceLocation> idPredicate, Predicate<String> exclusions) Removes recipes that pass the given id Predicate.voidremoveByRecipeTest(Predicate<T> recipePredicate) Removes recipes that pass the given recipe Predicate
-
Constructor Details
-
RecipeList
-
-
Method Details
-
getRecipesByOutput
Gets recipes based on the output item, checked against the given IIngredient.- Parameters:
output- The output of the recipes to get.- Returns:
- A List of recipes who's output matches the given IIngredient.
-
getAllRecipes
Gets a view of the recipes in this RecipeList.- Returns:
- A view of the recipes in this RecipeList.
-
get
Gets a recipe based on the given Id.- Parameters:
id- The resource location Id of the recipe.- Returns:
- Teh found recipe or null if not found.
-
get
Gets a recipe based on the given Id.- Parameters:
id- The string Id of the recipe.- Returns:
- Teh found recipe or null if not found.
-
has
public boolean has(net.minecraft.resources.ResourceLocation id) Checks if this list contains a recipe with the given key.- Parameters:
id- The resource location Id of the recipe.- Returns:
- True if the list has the recipe, false otherwise.
-
has
Checks if this list contains a recipe with the given key.- Parameters:
id- The string Id of the recipe.- Returns:
- True if the list has the recipe, false otherwise.
-
add
Adds the given recipe to this list.- Parameters:
id- The Id of the recipe.recipe- The recipe to add.
-
remove
public void remove(net.minecraft.resources.ResourceLocation id) Remove the recipe with the given Id.- Parameters:
id- The Id of the recipe to remove.
-
removeByRecipeTest
Removes recipes that pass the given recipe Predicate- Parameters:
recipePredicate- The predicate to check the recipes against.
-
removeByIdTest
Removes recipes that pass the given id Predicate.- Parameters:
idPredicate- The predicate to check the recipe id against.
-
removeByIdTest
public void removeByIdTest(Predicate<net.minecraft.resources.ResourceLocation> idPredicate, Predicate<String> exclusions) Removes recipes that pass the given id Predicate.- Parameters:
idPredicate- The predicate to check the recipe id against.exclusions- A predicate to exclude certain recipes from removal.
-
removeAll
public void removeAll()Removes all recipes in this list. -
getRecipeType
Gets the recipe type that this list deals with.- Returns:
- The recipe type that this list deals with.
-
getRecipes
Gets an unmodifiable view of the recipe map in this list.- Returns:
- An unmodifiable view of the recipe map in this list.
-
getByName
public Map<net.minecraft.resources.ResourceLocation,net.minecraft.world.item.crafting.Recipe<?>> getByName()Gets an unmodifiable view of the byName map in this list.- Returns:
- An unmodifiable view of the byName map in this list.
-
getSize
public int getSize()Gets how many recipes are in this list.- Returns:
- How many recipes are in this list.
-