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
(CompoundTag pTag, NonNullList<ItemStack> pItems, HolderLookup.Provider pLevelRegistry) static ItemStack
removeItem
(List<ItemStack> pStacks, int pIndex, int pAmount) static CompoundTag
saveAllItems
(CompoundTag pTag, NonNullList<ItemStack> pItems, boolean pAlwaysPutTag, HolderLookup.Provider pLevelRegistry) static CompoundTag
saveAllItems
(CompoundTag pTag, NonNullList<ItemStack> pItems, HolderLookup.Provider pLevelRegistry) static ItemStack
-
Field Details
-
TAG_ITEMS
- See Also:
-
-
Constructor Details
-
ContainerHelper
public ContainerHelper()
-
-
Method Details
-
removeItem
-
takeItem
-
saveAllItems
public static CompoundTag saveAllItems(CompoundTag pTag, NonNullList<ItemStack> pItems, HolderLookup.Provider pLevelRegistry) -
saveAllItems
public static CompoundTag saveAllItems(CompoundTag pTag, NonNullList<ItemStack> pItems, boolean pAlwaysPutTag, HolderLookup.Provider pLevelRegistry) -
loadAllItems
public static void loadAllItems(CompoundTag pTag, NonNullList<ItemStack> pItems, HolderLookup.Provider pLevelRegistry) -
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
-