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, Collection<net.minecraft.world.item.crafting.RecipeHolder<T>> recipes, Map<net.minecraft.resources.ResourceLocation, net.minecraft.world.item.crafting.RecipeHolder<?>> byName) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(net.minecraft.resources.ResourceLocation id, net.minecraft.world.item.crafting.RecipeHolder<T> recipe) Adds the given recipe to this list.net.minecraft.world.item.crafting.RecipeHolder<T> Gets a recipe based on the given id.net.minecraft.world.item.crafting.RecipeHolder<T> get(net.minecraft.resources.ResourceLocation id) Gets a recipe based on the given id.Gets an unmodifiable view of the byName map in this list.Collection<net.minecraft.world.item.crafting.RecipeHolder<T>> Gets an unmodifiable view of the recipes in this list.getRecipesByOutput(IIngredient output) Gets recipes based on the output item, checked against the given IIngredient.getRecipesMatching(Predicate<net.minecraft.world.item.crafting.RecipeHolder<T>> predicate) Gets recipes that match the predicate.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<net.minecraft.world.item.crafting.RecipeHolder<T>> recipePredicate) Removes recipes that pass the given recipe Predicate
-
Constructor Details
-
RecipeList
public RecipeList(net.minecraft.world.item.crafting.RecipeType<T> recipeType, Collection<net.minecraft.world.item.crafting.RecipeHolder<T>> recipes, Map<net.minecraft.resources.ResourceLocation, net.minecraft.world.item.crafting.RecipeHolder<?>> byName)
-
-
Method Details
-
getRecipesByOutput
public List<net.minecraft.world.item.crafting.RecipeHolder<T>> getRecipesByOutput(IIngredient output) 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.
-
getRecipesMatching
public List<net.minecraft.world.item.crafting.RecipeHolder<T>> getRecipesMatching(Predicate<net.minecraft.world.item.crafting.RecipeHolder<T>> predicate) Gets recipes that match the predicate.- Parameters:
predicate- A predicate ofnet.minecraft.world.item.crafting.RecipeHolder<T extends net.minecraft.world.item.crafting.Recipe<?>>to test recipes against.- Returns:
- A List of recipes that match the given predicate
-
get
public net.minecraft.world.item.crafting.RecipeHolder<T> get(net.minecraft.resources.ResourceLocation id) 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
public void add(net.minecraft.resources.ResourceLocation id, net.minecraft.world.item.crafting.RecipeHolder<T> recipe) 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
public void removeByRecipeTest(Predicate<net.minecraft.world.item.crafting.RecipeHolder<T>> recipePredicate) 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 recipes in this list.- Returns:
- An unmodifiable view of the recipes in this list.
-
getByName
public Map<net.minecraft.resources.ResourceLocation,net.minecraft.world.item.crafting.RecipeHolder<T>> 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.
-