Package de.Keyle.MyPet.api.gui
Interface SectionRenderer<S extends Section>
- Type Parameters:
S- the section record this renderer draws
public interface SectionRenderer<S extends Section>
Interface a section type implements to render itself into a Bukkit
Inventory
and respond to clicks on the slots it owns.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumWhat the menu should do after a renderer has handled a click. -
Method Summary
Modifier and TypeMethodDescriptiondefault booleanDecorative sections (border, fill) paint slots but yield rendering to non-decorative sections that also claim them.onClick(S section, ClickPayload payload, RenderContext ctx) Handle a click on a slot owned by this section.default voidonClose(S section, CloseReason reason, RenderContext ctx) Called once when the owningMenuInstanceis closing.ownedSlots(S section) Slot indices (0..rows*9-1) this section renders into in the given context.voidrender(S section, Inventory inv, RenderContext ctx) Render this section's items into the inventory.
-
Method Details
-
render
Render this section's items into the inventory. Called on open and on refresh.- Parameters:
section- the section to drawinv- the inventory to draw intoctx- per-render state
-
onClick
Handle a click on a slot owned by this section.- Parameters:
section- the section that owns the slotpayload- what was clicked and howctx- per-render state- Returns:
- what the menu should do next
-
onClose
Called once when the owningMenuInstanceis closing.- Parameters:
section- the section being torn downreason- why the menu is closingctx- per-render state
-
ownedSlots
Slot indices (0..rows*9-1) this section renders into in the given context.- Parameters:
section- the section to measure- Returns:
- the slot indices it renders into, from
0torows*9-1
-
decorative
default boolean decorative()Decorative sections (border, fill) paint slots but yield rendering to non-decorative sections that also claim them. The overlap validator skips decorative sections.- Returns:
trueif this section yields its slots to non-decorative sections
-