Inventory

open class Inventory

Utilities for interacting with and inspecting the inventory

See also

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
A pattern, or order, to drop items in

Functions

Link copied to clipboard
open fun contains(id: Array<Int>): Boolean
Checks if any inventory item exists with any of the specified ids param id the item ids
open fun contains(name: Array<String>): Boolean
Checks if any inventory item exists with any of the specified names param name the item names
Checks if any inventory item exists matching the specified filter param filter the item filter
Link copied to clipboard
open fun drop(ids: Array<Int>): Int
Drops all items with the specified ids
open fun drop(names: Array<String>): Int
Drops all items with the specified names
open fun drop(items: List<out Item>): Int
Drops all items in the specified list
Link copied to clipboard
Gets all inventory items
Link copied to clipboard
open fun getCount(id: Array<Int>): Int
Sums the item stacks of all inventory items with the specified item ids
open fun getCount(name: Array<String>): Int
Sums the item stacks of all inventory items with the specified item names
open fun getCount(filter: Predicate<InventoryItem>): Int
Sums the item stacks of all inventory items matching the specified filter
Link copied to clipboard
open fun getEmptySlots(): Int
Gets the number of open inventory slots
Link copied to clipboard
open fun getFilledSlots(): Int
Gets the amount of filled inventory slots
Link copied to clipboard
Gets the selected inventory item, if an item is selected
Link copied to clipboard
open fun isEmpty(): Boolean
Checks if the inventory is completely empty
Link copied to clipboard
open fun isFull(): Boolean
Checks if the inventory is full
Link copied to clipboard
open fun sort(ids: Array<Int>): Boolean
Sorts the inventory by ids in the order they are specified
open fun sort(names: Array<String>): Boolean
Sorts the inventory by names in the order they are specified
open fun sort(comparator: Comparator<InventoryItem>): Boolean
Sorts the inventory by the specified comparator