Inventory

An inventory that contains items.

The absence of a value in an inventory will always be represented by ItemStack.empty, not null. This includes the default values in lists of items, such as items.

Inheritors

Functions

Link copied to clipboard
abstract fun addItem(item: ItemStack)

Puts the specified item in the first available empty slot in this inventory, or does nothing if the inventory is full.

Link copied to clipboard
abstract fun clear()

Clears this inventory.

Link copied to clipboard
open fun forEach(p0: Consumer<in ItemStack>)
Link copied to clipboard
abstract fun getItem(index: Int): ItemStack

Retrieve an item from this inventory at the specified index.

Link copied to clipboard
abstract fun hasItem(item: ItemStack): Boolean

If this inventory contains the specified item.

Link copied to clipboard
abstract operator fun iterator(): Iterator<ItemStack>
Link copied to clipboard
abstract fun removeItem(item: ItemStack)

Removes the specified item from the array, or does nothing if there isn't an element that matches this item.

Link copied to clipboard
abstract fun setItem(index: Int, item: ItemStack)

Sets the item at the given index to the given item.

Link copied to clipboard

Properties

Link copied to clipboard
abstract val items: List<ItemStack>

The items in this inventory.

Link copied to clipboard
abstract val size: Int

The size of this inventory.

Link copied to clipboard
abstract val type: InventoryType

The type of this inventory.