Class ItemDisplay


public class ItemDisplay extends RenderObjectWidget
An immutable item description displayed at a grid slot; its icon is never takeable. Names and lore belong to the ItemSpec and are rendered for the viewer by the UI backend.
Since:
6.2.0
  • Field Details

    • icon

      private final ItemSpec icon
    • slot

      private final int slot
    • clickHandler

      @Nullable private final @Nullable GridAction clickHandler
  • Constructor Details

  • Method Details

    • builder

      public static ItemDisplay.Builder builder(ItemSpec icon)
      Parameters:
      icon - the immutable item description @return a new builder
    • getIcon

      public ItemSpec getIcon()
      Returns:
      the immutable item description
    • getSlot

      public int getSlot()
      Returns:
      the zero-based grid slot
    • getClickHandler

      @Nullable public @Nullable GridAction getClickHandler()
      Returns:
      the optional action, independent of inventory events
    • createElement

      @NotNull public @NotNull RenderObjectElement createElement()
      Description copied from class: Widget
      Creates the Element corresponding to this Widget.

      This is a framework-internal method; subclasses should return the Element implementation appropriate to the Widget type.

      Specified by:
      createElement in class RenderObjectWidget
      Returns:
      the corresponding Element instance