Class RecipeSnapshot
java.lang.Object
io.github.bakedlibs.dough.recipes.RecipeSnapshot
This class represents a Snapshot of the Server's registered Recipes.
- Author:
- TheBusyBiscuit
-
Constructor Summary
ConstructorsConstructorDescriptionRecipeSnapshot(Plugin plugin) This will create a Snapshot of all Recipes on the plugin's Server. -
Method Summary
Modifier and TypeMethodDescriptiongetRecipe(NamespacedKey key) This method will return aRecipebased on the providedNamespacedKey(if thatRecipeis of typeKeyed) The method works similar toBukkit.getRecipe(NamespacedKey), though it is significantly faster since we operate on a cachedHashMapand don't have to perform any data conversion.<T extends Recipe>
RecipeChoice[]getRecipeInput(MinecraftRecipe<? super T> recipeType, T recipe) This method will return an Array ofRecipeChoicerepresenting the given Recipe's input choices.<T extends Recipe>
RecipeChoice[]getRecipeInput(T recipe) This method will return an Array ofRecipeChoicerepresenting the given Recipe's input choices.getRecipeOutput(MinecraftRecipe<T> recipeType, ItemStack... inputs) This method will return anOptionaldescribing the output of a Recipe with the given type and given inputs.getRecipes(Class<T> recipeClass) This method will return aSetof Recipes of the given Type contained in thisRecipeSnapshot.getRecipes(Predicate<Recipe> predicate) This method will return all Recipes matching the givenPredicate.getRecipesFor(ItemStack item) getRecipesFor(Material type) getRecipesWith(ItemStack item) This method will return aStreamof Recipes of the given Type contained in thisRecipeSnapshot.This will stream all Recipes stored in this Snapshot.
-
Constructor Details
-
RecipeSnapshot
This will create a Snapshot of all Recipes on the plugin's Server.- Parameters:
plugin- The Plugin running on the Server that serves as the Snapshot's source.
-
-
Method Details
-
streamAllRecipes
This will stream all Recipes stored in this Snapshot.- Returns:
- A Stream of all Recipes in this Snapshot
-
getRecipes
This method will return aSetof Recipes of the given Type contained in thisRecipeSnapshot. -
stream
This method will return aStreamof Recipes of the given Type contained in thisRecipeSnapshot. -
getRecipeInput
@Nonnull public <T extends Recipe> RecipeChoice[] getRecipeInput(@Nonnull MinecraftRecipe<? super T> recipeType, @Nonnull T recipe) This method will return an Array ofRecipeChoicerepresenting the given Recipe's input choices.- Type Parameters:
T- The Type of recipe- Parameters:
recipeType- The Type of the given Reciperecipe- The Recipe to get the inputs from- Returns:
- The Inputs for the given Recipe
-
getRecipeInput
This method will return an Array ofRecipeChoicerepresenting the given Recipe's input choices. This will perform a call toMinecraftRecipe.of(Recipe)to find the given Recipe's Recipe Type. It is advised to prefer the usage ofgetRecipeInput(MinecraftRecipe, Recipe).- Type Parameters:
T- The Type of recipe- Parameters:
recipe- The Recipe to get the inputs from- Returns:
- The Inputs for the given Recipe
-
getRecipeOutput
@Nonnull public <T extends Recipe> Optional<ItemStack> getRecipeOutput(@Nonnull MinecraftRecipe<T> recipeType, ItemStack... inputs) This method will return anOptionaldescribing the output of a Recipe with the given type and given inputs. If no matching recipe was found, an emptyOptionalwill be returned.- Type Parameters:
T- The Type of recipe- Parameters:
recipeType- The Recipe Type you are looking forinputs- The Inputs to the Recipe you are looking for- Returns:
- An
Optionaldescribing the output of the Recipe matching your type and inputs
-
getRecipes
This method will return all Recipes matching the givenPredicate.- Parameters:
predicate- ThePredicateto filter recipes.- Returns:
- A Set of Recipes matching your filter.
-
getRecipesFor
-
getRecipesFor
-
getRecipesWith
-
getRecipe
This method will return aRecipebased on the providedNamespacedKey(if thatRecipeis of typeKeyed) The method works similar toBukkit.getRecipe(NamespacedKey), though it is significantly faster since we operate on a cachedHashMapand don't have to perform any data conversion.- Parameters:
key- TheNamespacedKey- Returns:
- The corresponding
Recipeor null
-