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
-
Field Summary
Fields inherited from class me.devnatan.inventoryframework.component.DefaultComponentBuilder
cancelOnClick, closeOnClick, data, displayCondition, isManagedExternally, reference, updateOnClick, watchingStates -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()@NotNull me.devnatan.inventoryframework.component.Componentcreate()booleanisContainedWithin(int position) Called when a player clicks on the item.onClick(@Nullable Consumer<? super SlotClickContext> clickHandler) Called when a player clicks on the item.onRender(@Nullable Consumer<? super SlotRenderContext> renderHandler) Called when the item is rendered.onUpdate(@Nullable Consumer<? super SlotContext> updateHandler) Called when the item is updated.renderWith(@NotNull Supplier<@Nullable org.bukkit.inventory.ItemStack> renderFactory) Dynamic rendering of a specific item.toString()withItem(@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.withSlot(int slot) withSlot(int row, int column) Methods inherited from class me.devnatan.inventoryframework.component.DefaultComponentBuilder
cancelOnClick, closeOnClick, displayIf, displayIf, hideIf, hideIf, referencedBy, updateOnClick, updateOnStateChange, updateOnStateChange, watch, withData, withExternallyManagedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface me.devnatan.inventoryframework.component.ComponentBuilder
cancelOnClick, closeOnClick, displayIf, displayIf, hideIf, hideIf, referencedBy, updateOnClick, updateOnStateChange, updateOnStateChange, watch, withData, withExternallyManaged
-
Constructor Details
-
BukkitItemComponentBuilder
public BukkitItemComponentBuilder(me.devnatan.inventoryframework.VirtualView root)
-
-
Method Details
-
toString
-
isContainedWithin
public boolean isContainedWithin(int position) - Specified by:
isContainedWithinin interfaceme.devnatan.inventoryframework.component.ItemComponentBuilder<BukkitItemComponentBuilder,Context>
-
withSlot
- Specified by:
withSlotin interfaceme.devnatan.inventoryframework.component.ItemComponentBuilder<BukkitItemComponentBuilder,Context>
-
withSlot
- Specified by:
withSlotin interfaceme.devnatan.inventoryframework.component.ItemComponentBuilder<BukkitItemComponentBuilder,Context>
-
withItem
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
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:
createin interfaceme.devnatan.inventoryframework.component.ComponentFactory
-
copy
- Specified by:
copyin interfaceme.devnatan.inventoryframework.component.ComponentBuilder<BukkitItemComponentBuilder,Context>
-