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.
  • Method Details

    • render

      void render(S section, Inventory inv, RenderContext ctx)
      Render this section's items into the inventory. Called on open and on refresh.
      Parameters:
      section - the section to draw
      inv - the inventory to draw into
      ctx - per-render state
    • onClick

      SectionRenderer.ClickResult onClick(S section, ClickPayload payload, RenderContext ctx)
      Handle a click on a slot owned by this section.
      Parameters:
      section - the section that owns the slot
      payload - what was clicked and how
      ctx - per-render state
      Returns:
      what the menu should do next
    • onClose

      default void onClose(S section, CloseReason reason, RenderContext ctx)
      Called once when the owning MenuInstance is closing.
      Parameters:
      section - the section being torn down
      reason - why the menu is closing
      ctx - per-render state
    • ownedSlots

      Set<Integer> ownedSlots(S section)
      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 0 to rows*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:
      true if this section yields its slots to non-decorative sections