Class ContainerHelper

java.lang.Object
net.minecraft.world.ContainerHelper

public class ContainerHelper extends Object
  • Field Details

  • Constructor Details

    • ContainerHelper

      public ContainerHelper()
  • Method Details

    • removeItem

      public static ItemStack removeItem(List<ItemStack> pStacks, int pIndex, int pAmount)
    • takeItem

      public static ItemStack takeItem(List<ItemStack> pStacks, int pIndex)
    • saveAllItems

      public static void saveAllItems(ValueOutput pOutput, NonNullList<ItemStack> pItems)
    • saveAllItems

      public static void saveAllItems(ValueOutput pOutput, NonNullList<ItemStack> pItems, boolean pAllowEmpty)
    • loadAllItems

      public static void loadAllItems(ValueInput pInput, NonNullList<ItemStack> pItems)
    • clearOrCountMatchingItems

      public static int clearOrCountMatchingItems(Container pContainer, Predicate<ItemStack> pItemPredicate, int pMaxItems, boolean pSimulate)
      Clears items from the inventory matching a predicate.
      Parameters:
      pMaxItems - The maximum amount of items to be cleared. A negative value means unlimited and 0 means count how many items are found that could be cleared.
      Returns:
      The amount of items cleared
    • clearOrCountMatchingItems

      public static int clearOrCountMatchingItems(ItemStack pStack, Predicate<ItemStack> pItemPredicate, int pMaxItems, boolean pSimulate)