Interface CraftingMatch


@NonExtendable public interface CraftingMatch
A recipe that matches a crafting grid: what one craft gives, and what it takes from each slot.

Instances are immutable.

Since:
0.1.0
  • Method Details

    • of

      static CraftingMatch of(CraftingRecipe recipe, ItemStack result, int[] consumed)
      Parameters:
      recipe - the recipe that matched
      result - what one craft gives, not empty
      consumed - how many items one craft takes from each slot of the input, row-major
      Returns:
      the match
      Throws:
      IllegalArgumentException - if result is empty or a count is negative
      Since:
      0.1.0
    • recipe

      CraftingRecipe recipe()
      Returns:
      the recipe that matched
      Since:
      0.1.0
    • result

      ItemStack result()
      Returns:
      what one craft gives
      Since:
      0.1.0
    • consumed

      int consumed(int slot)
      Parameters:
      slot - the slot index of the input, row-major
      Returns:
      how many items one craft takes from that slot, 0 outside the grid
      Since:
      0.1.0
    • withResult

      CraftingMatch withResult(ItemStack newResult)
      Parameters:
      newResult - what one craft gives instead
      Returns:
      a match taking the same items but giving newResult
      Since:
      0.1.0