public interface Recipe
A Recipe represents some craftable recipe in the game.
It is essentially a Predicate that checks for if a recipe is valid as well
as a function from a crafting matrix to a list of ItemStack
(the crafting result), therefore making it an immutable interface.
The passed in ItemGrid is usually a crafting inventory, e.g. a 2x2 or 3x3 crafting matrix.
The requirements of a Recipe can be general, they just have to eventually return a boolean given an itemgrid.
Modifier and Type | Method and Description |
---|---|
Optional<List<ItemStack>> |
getResults(GridInventory grid)
Returns the results for running this Recipe over an
GridInventory |
List<ItemType> |
getResultTypes()
Returns the list of item types that result when successful crafting of
this Recipe is completed.
|
boolean |
isValid(GridInventory grid)
Checks if the given
GridInventory fits the required constraints
to craft this Recipe. |
List<ItemType> getResultTypes()
boolean isValid(GridInventory grid)
GridInventory
fits the required constraints
to craft this Recipe.grid
- The ItemGrid to check for validityOptional<List<ItemStack>> getResults(GridInventory grid)
GridInventory
grid
- An ItemGrid as inputOptional.absent()
if the given
ItemGrid does not match this recipe's requirements.