Entry

Represents a single fetched inventory page.

Since

2.2.0

Parameters

paginated

Parent inventory

condition

Current display condition

page

Fetched page data

Type Parameters

T

Type of the fetched inventory

C

Type of the display condition

Inheritors

Constructors

Link copied to clipboard

Properties

Link copied to clipboard

Map of all buttons in the inventory

Link copied to clipboard
Link copied to clipboard
@get:NotNull
abstract val inventory: @NotNull Inventory
Link copied to clipboard
val line: Int

Number of rows in the inventory (must be between 1 and 6)

Link copied to clipboard
Link copied to clipboard
val size: Int

Total size of inventory (line * 9)

Link copied to clipboard

Storage options for this inventory's storable components

Link copied to clipboard

Set of all storable components in this inventory

Link copied to clipboard
val viewers: List<HumanEntity>

List of entities currently viewing this inventory

Functions

Link copied to clipboard
override fun button(slot: Int, item: KtInventoryButton<KtInventoryBase>)

Adds an existing button to a single slot

fun button(vararg slot: Int, item: KtInventoryButton<KtInventoryBase>)

Adds an existing button to multiple slots

fun button(slot: Int, itemStack: ItemStack, onClick: (KtInventoryButton.ClickEvent<AbstractKtInventory>) -> Unit = {})

Adds a button to a single slot with the given item and click handler

fun button(slots: Iterable<Int>, itemStack: ItemStack, onClick: (KtInventoryButton.ClickEvent<AbstractKtInventory>) -> Unit = {})
fun button(vararg slot: Int, itemStack: ItemStack, onClick: (KtInventoryButton.ClickEvent<AbstractKtInventory>) -> Unit = {})

Adds a button to multiple slots with the given item and click handler

Link copied to clipboard

Creates a new inventory button with the specified item and click handler

Link copied to clipboard
fun getItem(slot: Int): @Nullable ItemStack?

Gets the item at the specified slot

Link copied to clipboard

Gets all storables that have the given slot

Gets all storables that have any of the given slots

Link copied to clipboard
open override fun onClick(event: InventoryClickEvent)

Called when top inventory is clicked

Link copied to clipboard
open fun onClickBottom(event: InventoryClickEvent)

Called when bottom inventory is clicked

Link copied to clipboard
open override fun onClose(event: InventoryCloseEvent)

Called when inventory is closed

Link copied to clipboard
open fun onDrag(event: InventoryDragEvent)

Called when items are dragged in inventory

Link copied to clipboard
open override fun onOpen(event: InventoryOpenEvent)

Called when inventory is opened

Link copied to clipboard
override fun open(player: HumanEntity)

Opens this inventory for the given player

Link copied to clipboard
fun openNextPage(player: HumanEntity)

Opens the next page for a player if Page.nextCondition is available.

Link copied to clipboard
fun openPreviousPage(player: HumanEntity)

Opens the previous page for a player if Page.previousCondition is available.

Link copied to clipboard

Saves the state of all storable components in this inventory

Link copied to clipboard
fun setItem(slot: Int, item: ItemStack?)

Sets an item at the specified slot

Link copied to clipboard
fun storable(initialize: () -> List<ItemStack?> = { emptyList() }, onPreClick: (KtInventoryStorable.ClickEvent) -> KtInventoryStorable.EventResult = { KtInventoryStorable.EventResult.Allow }, onClick: (KtInventoryStorable.ClickEvent) -> Unit = {}, onPreDrag: (KtInventoryStorable.DragEvent) -> KtInventoryStorable.EventResult = { KtInventoryStorable.EventResult.Allow }, onDrag: (KtInventoryStorable.DragEvent) -> Unit = {}, save: (List<ItemStack?>) -> Unit = {})

Add a storable component using all slots in the inventory

fun storable(slots: Iterable<Int>, initialize: () -> List<ItemStack?> = { emptyList() }, onPreClick: (KtInventoryStorable.ClickEvent) -> KtInventoryStorable.EventResult = { KtInventoryStorable.EventResult.Allow }, onClick: (KtInventoryStorable.ClickEvent) -> Unit = {}, onPreDrag: (KtInventoryStorable.DragEvent) -> KtInventoryStorable.EventResult = { KtInventoryStorable.EventResult.Allow }, onDrag: (KtInventoryStorable.DragEvent) -> Unit = {}, save: (List<ItemStack?>) -> Unit = {}): KtInventoryStorable
fun storable(vararg slots: Int, initialize: () -> List<ItemStack?> = { emptyList() }, onPreClick: (KtInventoryStorable.ClickEvent) -> KtInventoryStorable.EventResult = { KtInventoryStorable.EventResult.Allow }, onClick: (KtInventoryStorable.ClickEvent) -> Unit = {}, onPreDrag: (KtInventoryStorable.DragEvent) -> KtInventoryStorable.EventResult = { KtInventoryStorable.EventResult.Allow }, onDrag: (KtInventoryStorable.DragEvent) -> Unit = {}, save: (List<ItemStack?>) -> Unit = {})

Add a storable component with the specified slot numbers