public class InventoryHelpers
extends java.lang.Object
IInventoryS.| Constructor and Description |
|---|
InventoryHelpers() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
addToSlot(net.minecraft.inventory.IInventory inventory,
int slot,
net.minecraft.item.ItemStack itemStack)
Try to add the given item to the given slot.
|
static void |
clearInventory(net.minecraft.inventory.IInventory inventory)
Erase a complete inventory
|
static net.minecraft.item.ItemStack |
getItemFromIndex(net.minecraft.entity.player.EntityPlayer player,
int itemIndex)
Get the item stack from the given index in the player inventory.
|
static void |
readFromNBT(net.minecraft.inventory.IInventory inventory,
net.minecraft.nbt.NBTTagCompound data,
java.lang.String tagName)
Read an inventory from NBT.
|
static void |
tryReAddToStack(net.minecraft.entity.player.EntityPlayer player,
net.minecraft.item.ItemStack originalStack,
net.minecraft.item.ItemStack newStackPart)
Try adding a new item stack originating from the given original stack to the same original stack.
|
static void |
validateNBTStorage(net.minecraft.inventory.IInventory inventory,
net.minecraft.item.ItemStack itemStack,
java.lang.String tagName)
Validate the NBT storage of the given inventory in the given item.
|
static void |
writeToNBT(net.minecraft.inventory.IInventory inventory,
net.minecraft.nbt.NBTTagCompound data,
java.lang.String tagName)
Write the given inventory to NBT.
|
public static void clearInventory(net.minecraft.inventory.IInventory inventory)
inventory - inventory to clearpublic static void tryReAddToStack(net.minecraft.entity.player.EntityPlayer player,
net.minecraft.item.ItemStack originalStack,
net.minecraft.item.ItemStack newStackPart)
player - The player.originalStack - The original item stack from which the new item stack originated.newStackPart - The new item stack.public static void validateNBTStorage(net.minecraft.inventory.IInventory inventory,
net.minecraft.item.ItemStack itemStack,
java.lang.String tagName)
inventory - The inventory.itemStack - The item stack to read/write.tagName - The tag name to read from.public static void readFromNBT(net.minecraft.inventory.IInventory inventory,
net.minecraft.nbt.NBTTagCompound data,
java.lang.String tagName)
inventory - The inventory.data - The tag to read from.tagName - The tag name to read from.public static void writeToNBT(net.minecraft.inventory.IInventory inventory,
net.minecraft.nbt.NBTTagCompound data,
java.lang.String tagName)
inventory - The inventory.data - The tag to write to.tagName - The tag name to write into.public static net.minecraft.item.ItemStack getItemFromIndex(net.minecraft.entity.player.EntityPlayer player,
int itemIndex)
player - The player.itemIndex - The index of the item in the inventory.public static boolean addToSlot(net.minecraft.inventory.IInventory inventory,
int slot,
net.minecraft.item.ItemStack itemStack)
inventory - The inventory.slot - The slot to add to.itemStack - The item to try to put in the production slot.