Abstract Kt Inventory
abstract class AbstractKtInventory(context: KtInventoryPluginContext, line: Int) : KtInventoryBase, InventoryHolder
Abstract base class for creating inventory-based GUIs. Handles inventory management, button interactions, and item storage functionality.
Since
2.0.0
Inheritors
Properties
Functions
Link copied to clipboard
Adds an existing button to a single slot
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
fun createButton(itemStack: ItemStack, onClick: (KtInventoryButton.ClickEvent<AbstractKtInventory>) -> Unit): KtInventoryButton<AbstractKtInventory>
Creates a new inventory button with the specified item and click handler
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
Called when bottom inventory is clicked
Link copied to clipboard
Saves the state of all storable components in this inventory
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