Interface CraftingRecipe

All Superinterfaces:
Recipe
All Known Subinterfaces:
ShapedRecipe, ShapelessRecipe, TransmuteRecipe

public interface CraftingRecipe extends Recipe
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 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 grid
      tags - resolves item tags
      Returns:
      what one craft gives and takes, or null when the grid does not match
      Since:
      0.1.0
    • group

      default String group()
      Returns:
      the recipes sharing a group are shown as one entry of the recipe book; empty for none
      Since:
      0.1.0
    • category

      default CraftingCategory category()
      Returns:
      the tab of the recipe book this recipe is filed under
      Since:
      0.1.0