getItem

open override fun getItem(): ItemStack?

Retrieves the item from the specified slot in the virtual inventory. If the slot index is out of bounds (not between 0 and size-1), this method will return null. Otherwise, it returns a clone of the ItemStack at the specified slot in the virtual inventory, allowing callers to safely modify the returned ItemStack without affecting the inventory's internal state. If the slot is empty (null), this method will also return null.