Interface Recipe

    • Method Detail

      • isValid

        boolean isValid​(Inventory inventory,
                        ServerWorld world)
        Checks if the given inventory fits the required constraints to make a valid recipe
        Parameters:
        inventory - The inventory to check for validity
        world - The world this recipe would be used in
        Returns:
        True if the given input matches this recipe's requirements
      • result

        ItemStackSnapshot result​(Inventory inventory)
        The result of this recipe. This method should only be called if isValid(Inventory, ServerWorld) returns true.

        This method is preferred over the exemplaryResult() method, as it may customize the result further depending on the context.

        Parameters:
        inventory - The input inventory
        Returns:
        The result of this recipe
      • exemplaryResult

        ItemStackSnapshot exemplaryResult()
        A general result of this recipe. This result may be customized depending on the context. See result(Inventory)
        Returns:
        The exemplary result of this recipe
      • remainingItems

        List<ItemStackSnapshot> remainingItems​(Inventory inventory)
        The remaining items result of this recipe. This method should only be called if isValid(Inventory, ServerWorld) returns true.

        A list of items to be added to the inventory of the player when they craft the result. For example, if a player crafts a ItemTypes.CAKE, the empty buckets are returned to their inventory.

        Parameters:
        inventory - The input inventory
        Returns:
        The list of items to be added to the inventory of the player when the recipe has been fulfilled (possibly empty)
      • ingredients

        List<Ingredient> ingredients()
        Gets the ingredients for this recipe.
        Returns:
        An unmodifiable list of the ingredients.
      • isDynamic

        boolean isDynamic()
        Returns true if the recipe is dynamic.

        Dynamic recipes are not displayed in the recipe book.

        Returns:
        Whether this recipe is dynamic.