public class InventoryHelper
extends java.lang.Object
| Constructor and Description |
|---|
InventoryHelper() |
| Modifier and Type | Method and Description |
|---|---|
static java.util.List<ItemInstance> |
collectItems(IInventory inventory)
Collects all the items in the inventory into single item instances
even if the inventory has items separated.
|
static int |
removeFrom(IInventory inv,
IUseInfo item)
Attempts to remove the item from the inventory, deducting the amounts from multiple item instances if needed.
|
public static java.util.List<ItemInstance> collectItems(IInventory inventory)
For example if you collect the players inventory and it has 1 stick slot with amount set to 5 and 3 stone slots each with amount set to 20, this method will return a list of 2 items, 1 stick with amount set to 5 and 1 stone with amount set to 60.
inventory - the inventory to collect items from.public static int removeFrom(IInventory inv, IUseInfo item)
inv - The inventory to remove the item fromitem - The item to remove from the inventory