Class MenuSizeRows
java.lang.Object
com.kamikazejam.kamicommon.menu.api.struct.size.MenuSizeRows
- All Implemented Interfaces:
MenuSize
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull MenuSizecopy()Deep copies thisMenuSizeinto an identical object clone.@NotNull InventorycreateInventory(@NotNull InventoryHolder owner, @NotNull VersionedComponent title) Creates a newInventorywith the givenInventoryHolderand title.
Uses thisMenuSizeto determine the size of the inventory.intintgetSlotInLastRow(int index) Returns the slot number for the slot in the last row with the given index in that row.intmapPositionToSlot(int row, int col) Maps a position to a slot number.static intmapPositionToSlot(int row, int col, int rows)
-
Constructor Details
-
MenuSizeRows
public MenuSizeRows(int rows)
-
-
Method Details
-
createInventory
@NotNull public @NotNull Inventory createInventory(@NotNull @NotNull InventoryHolder owner, @NotNull @NotNull VersionedComponent title) Description copied from interface:MenuSizeCreates a newInventorywith the givenInventoryHolderand title.
Uses thisMenuSizeto determine the size of the inventory.- Specified by:
createInventoryin interfaceMenuSize
-
getSlotInLastRow
public int getSlotInLastRow(int index) Description copied from interface:MenuSizeReturns the slot number for the slot in the last row with the given index in that row.- Specified by:
getSlotInLastRowin interfaceMenuSize
-
copy
Description copied from interface:MenuSizeDeep copies thisMenuSizeinto an identical object clone. -
getNumberOfSlots
public int getNumberOfSlots()- Specified by:
getNumberOfSlotsin interfaceMenuSize- Returns:
- the 1-index number of slots in this menu size.
-
mapPositionToSlot
Description copied from interface:MenuSizeMaps a position to a slot number. For example position (1, 1) maps to slot 0 (top-left) in a traditional inventory.- Specified by:
mapPositionToSlotin interfaceMenuSize- Parameters:
row- The row (top to bottom) of the position. (1-indexed)col- The column (left to right) of the position. (1-indexed)- Returns:
- The bukkit slot number corresponding to the given position.
- Throws:
IllegalStateException- if this method is called on an unsupported MenuSize (including someMenuSizeTypes using non-standardInventoryTypeconfigurations.)
-
mapPositionToSlot
- Throws:
IllegalArgumentException
-