Package net.minecraft.inventory
Class Inventories
java.lang.Object
net.minecraft.inventory.Inventories
public class Inventories extends Object
-
Constructor Summary
Constructors Constructor Description Inventories()
-
Method Summary
Modifier and Type Method 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 exceedingmaxCount
, 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 exceedingmaxCount
, 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)
-
Constructor Details
-
Inventories
public Inventories()
-
-
Method Details
-
splitStack
-
removeStack
-
toTag
-
toTag
public static CompoundTag toTag(CompoundTag tag, DefaultedList<ItemStack> stacks, boolean setIfEmpty) -
fromTag
-
remove
public static int remove(Inventory inventory, Predicate<ItemStack> shouldRemove, int maxCount, boolean dryRun)Removes a number, not exceedingmaxCount
, of items from an inventory based on a predicate and returns that number.- Parameters:
dryRun
- whether to return the number of items which would have been removed without actually removing them- Returns:
- the number of items removed
-
remove
public static int remove(ItemStack stack, Predicate<ItemStack> shouldRemove, int maxCount, boolean dryRun)Removes a number, not exceedingmaxCount
, of items from an item stack based on a predicate and returns that number.- Parameters:
dryRun
- whether to return the number of items which would have been removed without actually removing them- Returns:
- the number of items removed
-