All Known Implementing Classes:
GridSlotsLayout, OrderedSlotsLayout

public interface Layout
An ordered sequence of inventory slot positions used as a fill order, created from an ASCII grid (ofGrid(java.lang.String...)) or from explicit slot indices (ofSlots(int...)).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The width of a chest inventory row.
  • Method Summary

    Modifier and Type
    Method
    Description
    static @NotNull Layout
    ofGrid(@NotNull String... rows)
    Parses a row-by-row ASCII grid: ' ' marks an empty slot, every other character is a fill slot; fill order is by character code point (Unicode value), then occurrence order.
    static @NotNull Layout
    ofSlots(int... slots)
    Creates a layout that fills slots in exactly the given order.
    @NotNull List<Integer>
    Returns the slot positions in fill order.
  • Field Details

    • ROW_WIDTH

      static final int ROW_WIDTH
      The width of a chest inventory row.
      See Also:
  • Method Details

    • slots

      @NotNull @NotNull List<Integer> slots()
      Returns the slot positions in fill order.
      Returns:
      an unmodifiable ordered list of slot indices
    • ofGrid

      @NotNull static @NotNull Layout ofGrid(@NotNull @NotNull String... rows)
      Parses a row-by-row ASCII grid: ' ' marks an empty slot, every other character is a fill slot; fill order is by character code point (Unicode value), then occurrence order.
      Parameters:
      rows - the grid rows, each exactly ROW_WIDTH characters wide
      Returns:
      the parsed layout
      Throws:
      IllegalArgumentException - if a row is not exactly ROW_WIDTH characters wide
    • ofSlots

      @NotNull static @NotNull Layout ofSlots(int... slots)
      Creates a layout that fills slots in exactly the given order.
      Parameters:
      slots - the slot indices in fill order; each must be within 0-53 and unique
      Returns:
      the layout
      Throws:
      IllegalArgumentException - if an index is out of bounds or duplicated