Class RecipeManager

java.lang.Object
org.mockbukkit.mockbukkit.inventory.RecipeManager

public class RecipeManager extends Object
  • Constructor Details

    • RecipeManager

      public RecipeManager()
  • Method Details

    • reset

      public void reset()
      Resets the list of recipes to the default.
    • reset

      public void reset(@NotNull @NotNull RecipeType recipeType)
      Resets the list of recipes to the default for a given recipe type.
      Parameters:
      recipeType - The recipe type to reset.
    • getRecipes

      @NotNull public @NotNull Map<RecipeType,List<Recipe>> getRecipes()
      Get the list of recipes available.
      Returns:
      The list of recipes available.
    • getRecipes

      @NotNull public @NotNull List<Recipe> getRecipes(@NotNull @NotNull RecipeType recipeType)
      Get the list of recipes available for that recipe type.
      Parameters:
      recipeType - The recipe type.
      Returns:
      The list of recipes available.
    • getRecipeByKey

      @Nullable public @Nullable Recipe getRecipeByKey(@NotNull @NotNull RecipeType recipeType, @NotNull @NotNull NamespacedKey recipeKey)
      Helper function to lazy load the recipes.
      Parameters:
      recipeType - The recipe type to get the recipes.
      recipeKey - The recipe key to get the recipes.
      Returns:
      The server recipes.
    • getRecipesFor

      @NotNull public @NotNull List<Recipe> getRecipesFor(@NotNull @NotNull RecipeType recipeType, @NotNull @NotNull ItemStack itemStack)
      Get the list of recipes available to create a desired item.
      Parameters:
      recipeType - The recipe type.
      itemStack - The desired item.
      Returns:
      The list of recipes available to create.
    • getCraftingRecipe

      @Nullable public @Nullable Recipe getCraftingRecipe(@NotNull @NotNull ItemStack[] craftingMatrix)
    • addRecipe

      public boolean addRecipe(@NotNull @NotNull RecipeType recipeType, @NotNull @NotNull Recipe recipe)
      Add a recipe to the list of recipes.
      Parameters:
      recipeType - The recipe type.
      recipe - The recipe to be added.
      Returns:
      true if added, otherwise false.
    • removeRecipe

      public boolean removeRecipe(@NotNull @NotNull RecipeType recipeType, @NotNull @NotNull Recipe recipe)
      Remove a recipe to the list of recipes.
      Parameters:
      recipeType - The recipe type.
      recipe - The recipe to be removed.
      Returns:
      true if removed, otherwise false.
    • clearRecipes

      public void clearRecipes(RecipeType recipeType)
      Clears the list of recipes.
    • loadDefaultRecipes

      public static List<Recipe> loadDefaultRecipes(RecipeType recipeType)
    • loadDefaultRecipes

      public static Map<RecipeType,List<Recipe>> loadDefaultRecipes()
    • loadDefaultRecipesAsLists

      public static List<Recipe> loadDefaultRecipesAsLists()