Package net.minecraft.world
Class ContainerHelper
java.lang.Object
net.minecraft.world.ContainerHelper
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int
clearOrCountMatchingItems
(Container pContainer, Predicate<ItemStack> pItemPredicate, int pMaxItems, boolean pSimulate) Clears items from the inventory matching a predicate.static int
clearOrCountMatchingItems
(ItemStack pStack, Predicate<ItemStack> pItemPredicate, int pMaxItems, boolean pSimulate) static void
loadAllItems
(ValueInput pInput, NonNullList<ItemStack> pItems) static ItemStack
removeItem
(List<ItemStack> pStacks, int pIndex, int pAmount) static void
saveAllItems
(ValueOutput pOutput, NonNullList<ItemStack> pItems) static void
saveAllItems
(ValueOutput pOutput, NonNullList<ItemStack> pItems, boolean pAllowEmpty) static ItemStack
-
Field Details
-
TAG_ITEMS
- See Also:
-
-
Constructor Details
-
ContainerHelper
public ContainerHelper()
-
-
Method Details
-
removeItem
-
takeItem
-
saveAllItems
-
saveAllItems
public static void saveAllItems(ValueOutput pOutput, NonNullList<ItemStack> pItems, boolean pAllowEmpty) -
loadAllItems
-
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
-