Class ContainerHelper

java.lang.Object
net.ixdarklord.coolcatcore.api.utils.ContainerHelper

public final class ContainerHelper extends Object
Utility class providing convenience methods for working with Container and Player inventories. Includes item search, filtering, equality, and hashing utilities that simplify inventory-related logic.
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    containsItem(net.minecraft.world.Container container, net.minecraft.world.item.Item item)
     
    static boolean
    containsItem(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.Item item)
     
    static boolean
    equals(net.minecraft.world.Container a, net.minecraft.world.Container b)
     
    static boolean
    equals(net.minecraft.world.entity.player.Player a, net.minecraft.world.entity.player.Player b)
     
    static int
    findFirstSlotWithItem(net.minecraft.world.Container container, net.minecraft.world.item.Item item)
     
    static int
    findFirstSlotWithItem(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.Item item)
     
    getAllMatchingSlots(net.minecraft.world.Container container, Predicate<net.minecraft.world.item.ItemStack> predicate)
     
    getAllMatchingSlots(net.minecraft.world.Container container, net.minecraft.world.item.Item item)
     
    getAllMatchingSlots(net.minecraft.world.entity.player.Player player, Predicate<net.minecraft.world.item.ItemStack> predicate)
     
    getAllMatchingSlots(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.Item item)
     
    static List<net.minecraft.world.item.ItemStack>
    getAllMatchingStacks(net.minecraft.world.Container container, Predicate<net.minecraft.world.item.ItemStack> predicate)
     
    static List<net.minecraft.world.item.ItemStack>
    getAllMatchingStacks(net.minecraft.world.Container container, net.minecraft.world.item.Item item)
     
    static List<net.minecraft.world.item.ItemStack>
    getAllMatchingStacks(net.minecraft.world.entity.player.Player player, Predicate<net.minecraft.world.item.ItemStack> predicate)
     
    static List<net.minecraft.world.item.ItemStack>
    getAllMatchingStacks(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.Item item)
     
    static net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack>
    getItems(net.minecraft.world.Container container)
     
    static net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack>
    getItems(net.minecraft.world.entity.player.Player player)
     
    static int
    hashCode(net.minecraft.world.Container container)
     
    static int
    hashCode(net.minecraft.world.entity.player.Player player)
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • containsItem

      public static boolean containsItem(net.minecraft.world.Container container, net.minecraft.world.item.Item item)
    • findFirstSlotWithItem

      public static int findFirstSlotWithItem(net.minecraft.world.Container container, net.minecraft.world.item.Item item)
    • getAllMatchingStacks

      public static List<net.minecraft.world.item.ItemStack> getAllMatchingStacks(net.minecraft.world.Container container, net.minecraft.world.item.Item item)
    • getAllMatchingStacks

      public static List<net.minecraft.world.item.ItemStack> getAllMatchingStacks(net.minecraft.world.Container container, Predicate<net.minecraft.world.item.ItemStack> predicate)
    • getAllMatchingSlots

      public static List<SlotReference.Container> getAllMatchingSlots(net.minecraft.world.Container container, net.minecraft.world.item.Item item)
    • getAllMatchingSlots

      public static List<SlotReference.Container> getAllMatchingSlots(net.minecraft.world.Container container, Predicate<net.minecraft.world.item.ItemStack> predicate)
    • getItems

      public static net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> getItems(net.minecraft.world.Container container)
    • equals

      public static boolean equals(net.minecraft.world.Container a, net.minecraft.world.Container b)
    • hashCode

      public static int hashCode(net.minecraft.world.Container container)
    • containsItem

      public static boolean containsItem(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.Item item)
    • findFirstSlotWithItem

      public static int findFirstSlotWithItem(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.Item item)
    • getAllMatchingStacks

      public static List<net.minecraft.world.item.ItemStack> getAllMatchingStacks(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.Item item)
    • getAllMatchingStacks

      public static List<net.minecraft.world.item.ItemStack> getAllMatchingStacks(net.minecraft.world.entity.player.Player player, Predicate<net.minecraft.world.item.ItemStack> predicate)
    • getAllMatchingSlots

      public static List<SlotReference.Player> getAllMatchingSlots(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.Item item)
    • getAllMatchingSlots

      public static List<SlotReference.Player> getAllMatchingSlots(net.minecraft.world.entity.player.Player player, Predicate<net.minecraft.world.item.ItemStack> predicate)
    • getItems

      public static net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> getItems(net.minecraft.world.entity.player.Player player)
    • equals

      public static boolean equals(net.minecraft.world.entity.player.Player a, net.minecraft.world.entity.player.Player b)
    • hashCode

      public static int hashCode(net.minecraft.world.entity.player.Player player)