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 voidfromTag(CompoundTag tag, DefaultedList<ItemStack> stacks)static intremove(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 intremove(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 ItemStackremoveStack(List<ItemStack> stacks, int slot)static ItemStacksplitStack(List<ItemStack> stacks, int slot, int amount)static CompoundTagtoTag(CompoundTag tag, DefaultedList<ItemStack> stacks)static CompoundTagtoTag(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
-