public class InventoryUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static ForgeDirection[] |
chestSides |
| Constructor and Description |
|---|
InventoryUtils() |
| Modifier and Type | Method and Description |
|---|---|
static int |
actualDamage(ItemStack stack)
Gets the actual damage of an item without asking the Item
|
static boolean |
areStacksIdentical(ItemStack stack1,
ItemStack stack2) |
static boolean |
canStack(ItemStack stack1,
ItemStack stack2) |
static void |
consumeItem(IInventory inv,
int slot)
Consumes one item from slot in inv with support for containers.
|
static ItemStack |
copyStack(ItemStack stack,
int quantity)
Copies an itemstack with a new quantity
|
static ItemStack |
decrStackSize(IInventory inv,
int slot,
int size)
Static default implementation for IInventory method
|
static void |
dropItem(ItemStack stack,
World world,
Vector3 dropLocation)
Spawns an itemstack in the world at a location
|
static void |
dropOnClose(EntityPlayer player,
IInventory inv)
Drops all items from inv using getStackInSlotOnClosing
|
static int |
fitStackInSlot(IInventory inv,
int slot,
ItemStack stack) |
static int |
fitStackInSlot(InventoryRange inv,
int slot,
ItemStack stack) |
static IInventory |
getChest(TileEntityChest chest) |
static ItemStack |
getExtractableStack(IInventory inv,
int slot) |
static ItemStack |
getExtractableStack(InventoryRange inv,
int slot)
Gets the stack in slot if it can be extracted
|
static int |
getInsertibleQuantity(IInventory inv,
ItemStack stack) |
static int |
getInsertibleQuantity(InventoryRange inv,
ItemStack stack)
Gets the maximum quantity of an item that can be inserted into inv
|
static IInventory |
getInventory(World world,
int x,
int y,
int z)
Gets an IInventory from a coordinate with support for double chests
|
static ItemStack |
getStackInSlotOnClosing(IInventory inv,
int slot)
Static default implementation for IInventory method
|
static int |
incrStackSize(ItemStack base,
int addition) |
static int |
incrStackSize(ItemStack base,
ItemStack addition) |
static int |
insertItem(IInventory inv,
ItemStack stack,
boolean simulate) |
static int |
insertItem(InventoryRange inv,
ItemStack stack,
boolean simulate) |
static ItemStack |
loadPersistant(NBTTagCompound tag) |
static ItemStack |
newItemStack(Item item,
int size,
int damage,
NBTTagCompound tag)
Constructor for ItemStack with tag
|
static void |
readItemStacksFromTag(ItemStack[] items,
NBTTagList tagList)
NBT item loading function with support for stack sizes > 32K
|
static NBTTagCompound |
savePersistant(ItemStack stack,
NBTTagCompound tag) |
static int |
stackSize(IInventory inv,
int slot)
Gets the size of the stack in a slot.
|
static NBTTagList |
writeItemStacksToTag(ItemStack[] items)
NBT item saving function
|
static NBTTagList |
writeItemStacksToTag(ItemStack[] items,
int maxQuantity)
NBT item saving function with support for stack sizes > 32K
|
public static ItemStack newItemStack(Item item,
int size,
int damage,
NBTTagCompound tag)
public static int actualDamage(ItemStack stack)
public static ItemStack decrStackSize(IInventory inv,
int slot,
int size)
public static ItemStack getStackInSlotOnClosing(IInventory inv,
int slot)
public static int incrStackSize(ItemStack base,
ItemStack addition)
public static int incrStackSize(ItemStack base,
int addition)
public static NBTTagList writeItemStacksToTag(ItemStack[] items)
public static NBTTagList writeItemStacksToTag(ItemStack[] items,
int maxQuantity)
public static void readItemStacksFromTag(ItemStack[] items,
NBTTagList tagList)
public static void dropItem(ItemStack stack,
World world,
Vector3 dropLocation)
public static ItemStack copyStack(ItemStack stack,
int quantity)
public static int getInsertibleQuantity(InventoryRange inv, ItemStack stack)
public static int getInsertibleQuantity(IInventory inv,
ItemStack stack)
public static int fitStackInSlot(InventoryRange inv, int slot, ItemStack stack)
public static int fitStackInSlot(IInventory inv,
int slot,
ItemStack stack)
public static int insertItem(InventoryRange inv, ItemStack stack, boolean simulate)
simulate - If set to true, no items will actually be insertedpublic static int insertItem(IInventory inv,
ItemStack stack,
boolean simulate)
public static ItemStack getExtractableStack(InventoryRange inv, int slot)
public static ItemStack getExtractableStack(IInventory inv,
int slot)
public static boolean areStacksIdentical(ItemStack stack1,
ItemStack stack2)
public static IInventory getInventory(World world,
int x,
int y,
int z)
public static IInventory getChest(TileEntityChest chest)
public static boolean canStack(ItemStack stack1,
ItemStack stack2)
public static void consumeItem(IInventory inv,
int slot)
public static int stackSize(IInventory inv,
int slot)
public static void dropOnClose(EntityPlayer player,
IInventory inv)
public static NBTTagCompound savePersistant(ItemStack stack,
NBTTagCompound tag)
public static ItemStack loadPersistant(NBTTagCompound tag)