Class ContainerHelper
java.lang.Object
net.minecraft.world.ContainerHelper
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intclearOrCountMatchingItems(Container container, Predicate<ItemStack> predicate, int amountToRemove, boolean countingOnly) Clears items from the inventory matching a predicate.static intclearOrCountMatchingItems(ItemStack itemStack, Predicate<ItemStack> predicate, int amountToRemove, boolean countingOnly) static voidloadAllItems(ValueInput input, NonNullList<ItemStack> itemStacks) static ItemStackremoveItem(List<ItemStack> itemStacks, int slot, int count) static voidsaveAllItems(ValueOutput output, NonNullList<ItemStack> itemStacks) static voidsaveAllItems(ValueOutput output, NonNullList<ItemStack> itemStacks, boolean alsoWhenEmpty) static ItemStack
-
Field Details
-
TAG_ITEMS
- See Also:
-
-
Constructor Details
-
ContainerHelper
public ContainerHelper()
-
-
Method Details
-
removeItem
-
takeItem
-
saveAllItems
-
saveAllItems
public static void saveAllItems(ValueOutput output, NonNullList<ItemStack> itemStacks, boolean alsoWhenEmpty) -
loadAllItems
-
clearOrCountMatchingItems
public static int clearOrCountMatchingItems(Container container, Predicate<ItemStack> predicate, int amountToRemove, boolean countingOnly) Clears items from the inventory matching a predicate.- Parameters:
amountToRemove- 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
-