Interface RecipeManager

    • Method Detail

      • byKey

        Optional<Recipe> byKey​(ResourceKey key)
        Gets a recipe by its key.
        Parameters:
        key - the recipe key
        Returns:
        The recipe if available
      • all

        Collection<Recipe> all()
        Gets all registered recipes.
        Returns:
        All registered recipes.
      • allOfType

        <T extends RecipeCollection<T> allOfType​(RecipeType<T> type)
        Returns all registered recipes of given type
        Parameters:
        type - The recipe type
        Returns:
        All recipes of given type
      • allOfType

        default <T extends RecipeCollection<T> allOfType​(Supplier<? extends RecipeType<T>> supplier)
        Returns all registered recipes of given type
        Parameters:
        supplier - The recipe type
        Returns:
        All recipes of given type
      • findByResult

        <T extends RecipeCollection<T> findByResult​(RecipeType<T> type,
                                                      ItemStackSnapshot result)
        Returns all registered recipes of given type and with given item as a result.
        Parameters:
        type - The recipe type
        result - The recipe result to match
        Returns:
        The recipes resulting in given item.
      • findByResult

        default <T extends RecipeCollection<T> findByResult​(Supplier<? extends RecipeType<T>> supplier,
                                                              ItemStackSnapshot result)
        Gets all recipes with given item as a result.
        Parameters:
        result - the recipe result to match
        Returns:
        All recipes resulting in given item.
      • findMatchingRecipe

        Optional<Recipe> findMatchingRecipe​(Inventory inventory,
                                            ServerWorld world)
        Finds a matching recipe for given inventory and world.
        Parameters:
        inventory - The input inventory
        world - The world
        Returns:
        The found Recipe, or Optional.empty() if no recipe was found for this configuration
      • findMatchingRecipe

        <T extends RecipeOptional<T> findMatchingRecipe​(RecipeType<T> type,
                                                          Inventory inventory,
                                                          ServerWorld world)
        Finds a matching recipe for given type, inventory and world
        Parameters:
        type - The recipe type
        inventory - The input inventory
        world - The world
        Returns:
        The matching recipes.
      • findMatchingRecipe

        default <T extends RecipeOptional<T> findMatchingRecipe​(Supplier<? extends RecipeType<T>> supplier,
                                                                  Inventory inventory,
                                                                  ServerWorld world)
        Finds a matching recipe for given type, inventory and world
        Parameters:
        supplier - The recipe type
        inventory - The input inventory
        world - The world
        Returns:
        The matching recipes.
      • findCookingRecipe

        <T extends CookingRecipeOptional<T> findCookingRecipe​(RecipeType<T> type,
                                                                ItemStackSnapshot ingredient)
        Finds a matching cooking recipe for given type and ingredient
        Parameters:
        type - The recipe type
        ingredient - The ingredient
        Returns:
        The matching recipe.
      • findCookingRecipe

        default <T extends CookingRecipeOptional<T> findCookingRecipe​(Supplier<? extends RecipeType<T>> supplier,
                                                                        ItemStackSnapshot ingredient)
        Finds a matching cooking recipe for given type and ingredient
        Parameters:
        supplier - The recipe type
        ingredient - The ingredient
        Returns:
        The matching recipe.