Interface ShapedRecipe

All Superinterfaces:
CraftingRecipe, Recipe

@NonExtendable public interface ShapedRecipe extends CraftingRecipe
A recipe whose ingredients must sit in a given layout, anywhere in the grid.

Like vanilla, the empty rows and columns around the pattern are trimmed, the pattern may sit anywhere in a grid large enough to hold it, and it also matches flipped left to right unless told otherwise. Every slot outside the pattern must be empty.

Each ingredient takes its own count from its slot, so a pattern may ask for sixteen diamond blocks in one slot and a single stick in another.

Since:
0.1.0
  • Field Details

    • MAX_SIZE

      static final int MAX_SIZE
      The largest pattern, the size of a crafting table.
      Since:
      0.1.0
      See Also:
  • Method Details

    • builder

      static ShapedRecipe.Builder builder(Key key)
      Parameters:
      key - the identifier of the recipe
      Returns:
      a builder for a shaped recipe
      Since:
      0.1.0
    • width

      int width()
      Returns:
      the number of columns of the trimmed pattern
      Since:
      0.1.0
    • height

      int height()
      Returns:
      the number of rows of the trimmed pattern
      Since:
      0.1.0
    • ingredient

      @Nullable Ingredient ingredient(int x, int y)
      Parameters:
      x - the column of the trimmed pattern
      y - the row of the trimmed pattern
      Returns:
      what that cell asks for, null when it must stay empty
      Throws:
      IndexOutOfBoundsException - if the cell is outside the pattern
      Since:
      0.1.0
    • result

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

      boolean mirrored()
      Returns:
      whether the pattern also matches flipped left to right
      Since:
      0.1.0