Class ChestView
java.lang.Object
me.agent.vgui.api.ChestView
- All Implemented Interfaces:
View
Convenience base class for static 9xN chest menus: call
setItem(int, ViewItem) in your
constructor and the items are applied every time the view opens. For dynamic menus
override onOpen(ViewContents) (call super.onOpen(contents) to keep
the static items) or use VGui.chest(int).-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedChestView(int rows, net.kyori.adventure.text.Component title) -
Method Summary
Modifier and TypeMethodDescriptionvoidonOpen(ViewContents contents) Called right after the window opens (and again if the view is re-opened via back-navigation).final introws()Number of chest rows (1-6).protected final voidSets or replaces a static item at a row/column position.protected final voidSets or replaces a static item;nullremoves it.final intsize()Total slot count (rows() * 9).final net.kyori.adventure.text.Componenttitle()Title shown on the container.final ViewTypetype()The window type (determines slot count and shape).Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface View
cancelClientTransactions, clickCooldownMillis, onAnvilInput, onClick, onClose
-
Constructor Details
-
ChestView
protected ChestView(int rows, net.kyori.adventure.text.Component title)
-
-
Method Details
-
rows
public final int rows()Number of chest rows (1-6). -
size
public final int size()Total slot count (rows() * 9). -
title
-
type
-
setItem
Sets or replaces a static item;nullremoves it. Ignores out-of-range slots. -
setItem
Sets or replaces a static item at a row/column position.- Throws:
IllegalArgumentException- if the coordinate is outside this chest
-
onOpen
Description copied from interface:ViewCalled right after the window opens (and again if the view is re-opened via back-navigation). Populatecontentshere; mutations made inside this callback are sent as one batch.
-