Interface Layout
- 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 -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull LayoutParses 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 LayoutofSlots(int... slots) Creates a layout that fills slots in exactly the given order.slots()Returns the slot positions in fill order.
-
Field Details
-
ROW_WIDTH
static final int ROW_WIDTHThe width of a chest inventory row.- See Also:
-
-
Method Details
-
slots
Returns the slot positions in fill order.- Returns:
- an unmodifiable ordered list of slot indices
-
ofGrid
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 exactlyROW_WIDTHcharacters wide- Returns:
- the parsed layout
- Throws:
IllegalArgumentException- if a row is not exactlyROW_WIDTHcharacters wide
-
ofSlots
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
-