public class ContainerHelper
extends java.lang.Object
| Constructor and Description |
|---|
ContainerHelper() |
| Modifier and Type | Method and Description |
|---|---|
static int |
findSlotMatchingItem(net.minecraft.item.ItemStack toMatch,
net.minecraft.inventory.IInventory inventory)
Finds the first slot index of a matching
ItemStack in a given inventory, only comparing item equality,
ignoring all other properties such as quantity, damage, NBT, etc. |
static java.util.List<net.minecraft.item.ItemStack> |
getAllItems(net.minecraft.inventory.IInventory inventory)
Collects all items in a given inventory into a list.
|
static boolean |
hasItem(net.minecraft.item.Item item,
net.minecraft.inventory.IInventory inventory)
Checks if a given inventory contains a given item at all, anywhere.
|
static boolean |
hasItem(net.minecraft.item.Item item,
net.minecraft.entity.player.PlayerEntity player)
Checks if a given player has a given item in their inventory.
|
public static int findSlotMatchingItem(net.minecraft.item.ItemStack toMatch,
net.minecraft.inventory.IInventory inventory)
ItemStack in a given inventory, only comparing item equality,
ignoring all other properties such as quantity, damage, NBT, etc. If no such match is found, -1 is returned.toMatch - the ItemStack to compare the rest of the inventory to.inventory - the inventory to search for a match in.ItemStack, or otherwise -1.public static boolean hasItem(net.minecraft.item.Item item,
net.minecraft.inventory.IInventory inventory)
item - the Item to try and find.inventory - the inventory to search for a match in.public static boolean hasItem(net.minecraft.item.Item item,
net.minecraft.entity.player.PlayerEntity player)
item - the Item to try and find.player - the player to search for a match on.public static java.util.List<net.minecraft.item.ItemStack> getAllItems(net.minecraft.inventory.IInventory inventory)
inventory - The IInventory to collect from.ItemStacks of the given inventory.