Inventory

public class Inventory

Utilities for interacting with and inspecting the inventory

See also

Types

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

Functions

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