Class BukkitItemComponentBuilder

java.lang.Object
me.devnatan.inventoryframework.component.DefaultComponentBuilder<BukkitItemComponentBuilder,Context>
me.devnatan.inventoryframework.component.BukkitItemComponentBuilder
All Implemented Interfaces:
me.devnatan.inventoryframework.component.ComponentBuilder<BukkitItemComponentBuilder,Context>, me.devnatan.inventoryframework.component.ComponentFactory, me.devnatan.inventoryframework.component.ItemComponentBuilder<BukkitItemComponentBuilder,Context>

public final class BukkitItemComponentBuilder extends me.devnatan.inventoryframework.component.DefaultComponentBuilder<BukkitItemComponentBuilder,Context> implements me.devnatan.inventoryframework.component.ItemComponentBuilder<BukkitItemComponentBuilder,Context>, me.devnatan.inventoryframework.component.ComponentFactory
  • Constructor Details

    • BukkitItemComponentBuilder

      public BukkitItemComponentBuilder(me.devnatan.inventoryframework.VirtualView root)
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isContainedWithin

      public boolean isContainedWithin(int position)
      Specified by:
      isContainedWithin in interface me.devnatan.inventoryframework.component.ItemComponentBuilder<BukkitItemComponentBuilder,Context>
    • withSlot

      public BukkitItemComponentBuilder withSlot(int slot)
      Specified by:
      withSlot in interface me.devnatan.inventoryframework.component.ItemComponentBuilder<BukkitItemComponentBuilder,Context>
    • withSlot

      public BukkitItemComponentBuilder withSlot(int row, int column)
      Specified by:
      withSlot in interface me.devnatan.inventoryframework.component.ItemComponentBuilder<BukkitItemComponentBuilder,Context>
    • withItem

      public BukkitItemComponentBuilder withItem(@Nullable @Nullable org.bukkit.inventory.ItemStack item)
      Defines the item that will be used as fallback for rendering in the slot where this item is positioned. The fallback item is always static.
      Parameters:
      item - The new fallback item stack.
      Returns:
      This item builder.
    • onRender

      public BukkitItemComponentBuilder onRender(@Nullable @Nullable Consumer<? super SlotRenderContext> renderHandler)
      Called when the item is rendered.

      This handler is called every time the item or the view that owns it is updated.

      Parameters:
      renderHandler - The render handler.
      Returns:
      This item builder.
    • renderWith

      public BukkitItemComponentBuilder renderWith(@NotNull @NotNull Supplier<@Nullable org.bukkit.inventory.ItemStack> renderFactory)
      Dynamic rendering of a specific item.

      This handler is called every time the item or the view that owns it is updated.

      Parameters:
      renderFactory - The render handler.
      Returns:
      This item builder.
    • onClick

      public BukkitItemComponentBuilder onClick(@Nullable @Nullable Consumer<? super SlotClickContext> clickHandler)
      Called when a player clicks on the item.

      This handler works on any container that the actor has access to and only works if the interaction has not been cancelled.

      Parameters:
      clickHandler - The click handler.
      Returns:
      This item builder.
    • onClick

      public BukkitItemComponentBuilder onClick(@Nullable @Nullable Runnable clickHandler)
      Called when a player clicks on the item.

      This handler works on any container that the actor has access to and only works if the interaction has not been cancelled.

      Parameters:
      clickHandler - The click handler.
      Returns:
      This item builder.
    • onUpdate

      public BukkitItemComponentBuilder onUpdate(@Nullable @Nullable Consumer<? super SlotContext> updateHandler)
      Called when the item is updated.
      Parameters:
      updateHandler - The update handler.
      Returns:
      This item builder.
    • create

      @NotNull public @NotNull me.devnatan.inventoryframework.component.Component create()
      Specified by:
      create in interface me.devnatan.inventoryframework.component.ComponentFactory
    • copy

      Specified by:
      copy in interface me.devnatan.inventoryframework.component.ComponentBuilder<BukkitItemComponentBuilder,Context>