Enum Class ViewType
- All Implemented Interfaces:
Serializable, Comparable<ViewType>, Constable
The kind of container window a
View renders as.
Each type carries its fixed top-inventory slot count and column width used for row/column math in layouts and fill helpers. The player inventory (36 slots) is always appended after the top inventory by the client.
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAnvil window (3 slots: two inputs, one output).Generic chest with 1 row (9 slots).Generic chest with 2 rows (18 slots).Generic chest with 3 rows (27 slots).Generic chest with 4 rows (36 slots).Generic chest with 5 rows (45 slots).Generic chest with 6 rows (54 slots).3x3 dispenser-style grid (9 slots).Hopper window (5 slots in one row). -
Method Summary
Modifier and TypeMethodDescriptionstatic ViewTypechestForSize(int size) Smallest chest type that fitssizeslots (clamped to [9, 54], rounded up to a full row).static ViewTypechestRows(int rows) Chest type for the given row count.intcolumns()Number of columns per row (9 for chests, 5 for hopper, 3 for dispenser/anvil).booleanisChest()True for any of the generic 9xN chest types.introws()Number of rows (slots() / columns()).intslots()Number of slots in the top (GUI) inventory.static ViewTypeReturns the enum constant of this class with the specified name.static ViewType[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
CHEST_9X1
Generic chest with 1 row (9 slots). -
CHEST_9X2
Generic chest with 2 rows (18 slots). -
CHEST_9X3
Generic chest with 3 rows (27 slots). -
CHEST_9X4
Generic chest with 4 rows (36 slots). -
CHEST_9X5
Generic chest with 5 rows (45 slots). -
CHEST_9X6
Generic chest with 6 rows (54 slots). -
HOPPER
Hopper window (5 slots in one row). -
DISPENSER
3x3 dispenser-style grid (9 slots). -
ANVIL
Anvil window (3 slots: two inputs, one output). Supports text input via the rename field. SeeAnvilInputView.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
slots
public int slots()Number of slots in the top (GUI) inventory. -
columns
public int columns()Number of columns per row (9 for chests, 5 for hopper, 3 for dispenser/anvil). -
rows
public int rows()Number of rows (slots() / columns()). -
isChest
public boolean isChest()True for any of the generic 9xN chest types. -
chestRows
Chest type for the given row count.- Parameters:
rows- rows in [1, 6]- Returns:
- the matching CHEST_9xN type
- Throws:
IllegalArgumentException- if rows is out of range
-
chestForSize
Smallest chest type that fitssizeslots (clamped to [9, 54], rounded up to a full row).
-