Interface CraftingRecipe
- All Superinterfaces:
Recipe
- All Known Subinterfaces:
ShapedRecipe, ShapelessRecipe, TransmuteRecipe
A recipe made in a crafting grid, the 2×2 one of the inventory or the 3×3 one of a crafting
table.
ShapedRecipe, ShapelessRecipe and TransmuteRecipe cover what vanilla
does. A plugin needing something else implements this interface: match(CraftingInput, ItemTagLookup) sees the whole
grid and decides, through CraftingMatch.of(CraftingRecipe, ItemStack, int[]), what comes out and what each slot loses.
Implementations must be thread-safe: the server matches recipes from the threads of the players crafting.
- Since:
- 0.1.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault CraftingCategorycategory()default Stringgroup()match(CraftingInput input, ItemTagLookup tags) Checks a grid against this recipe.
-
Method Details
-
match
Checks a grid against this recipe.Called each time a grid changes, so keep it cheap. It must not change anything: the server takes the items only once the player picks the result up.
- Parameters:
input- the gridtags- resolves item tags- Returns:
- what one craft gives and takes, or
nullwhen the grid does not match - Since:
- 0.1.0
-
group
- Returns:
- the recipes sharing a group are shown as one entry of the recipe book; empty for none
- Since:
- 0.1.0
-
category
- Returns:
- the tab of the recipe book this recipe is filed under
- Since:
- 0.1.0
-