Class Inventories

java.lang.Object
net.minecraft.inventory.Inventories

public class Inventories
extends Object
  • Constructor Details

    • Inventories

      public Inventories()
  • Method Details

    • splitStack

      public static ItemStack splitStack​(List<ItemStack> stacks, int slot, int amount)
    • removeStack

      public static ItemStack removeStack​(List<ItemStack> stacks, int slot)
    • toTag

      public static CompoundTag toTag​(CompoundTag tag, DefaultedList<ItemStack> stacks)
    • toTag

      public static CompoundTag toTag​(CompoundTag tag, DefaultedList<ItemStack> stacks, boolean setIfEmpty)
    • fromTag

      public static void fromTag​(CompoundTag tag, DefaultedList<ItemStack> stacks)
    • remove

      public 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.
      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 exceeding maxCount, 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