public class Inventories extends Object
Constructor and Description |
---|
Inventories() |
Modifier and Type | Method and Description |
---|---|
static void |
fromTag(CompoundTag tag,
DefaultedList<ItemStack> stacks) |
static int |
remove(Inventory inventory,
Predicate<ItemStack> shouldRemove,
int maxCount,
boolean dryRun)
Removes a number, not exceeding
maxCount , of items from an inventory based on a predicate and returns that number. |
static int |
remove(ItemStack stack,
Predicate<ItemStack> shouldRemove,
int maxCount,
boolean dryRun)
Removes a number, not exceeding
maxCount , of items from an item stack based on a predicate and returns that number. |
static ItemStack |
removeStack(List<ItemStack> stacks,
int slot) |
static ItemStack |
splitStack(List<ItemStack> stacks,
int slot,
int amount) |
static CompoundTag |
toTag(CompoundTag tag,
DefaultedList<ItemStack> stacks) |
static CompoundTag |
toTag(CompoundTag tag,
DefaultedList<ItemStack> stacks,
boolean setIfEmpty) |
public static CompoundTag toTag(CompoundTag tag, DefaultedList<ItemStack> stacks)
public static CompoundTag toTag(CompoundTag tag, DefaultedList<ItemStack> stacks, boolean setIfEmpty)
public static void fromTag(CompoundTag tag, DefaultedList<ItemStack> stacks)
public static int remove(Inventory inventory, Predicate<ItemStack> shouldRemove, int maxCount, boolean dryRun)
maxCount
, of items from an inventory based on a predicate and returns that number.dryRun
- whether to return the number of items which would have been removed without actually removing thempublic static int remove(ItemStack stack, Predicate<ItemStack> shouldRemove, int maxCount, boolean dryRun)
maxCount
, of items from an item stack based on a predicate and returns that number.dryRun
- whether to return the number of items which would have been removed without actually removing them