public class MalisisInventory
extends java.lang.Object
implements net.minecraft.inventory.IInventory
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Set<MalisisInventoryContainer> |
containers
List of
MalisisInventory that is currently containing this MalisisInventory. |
protected int |
inventoryId
The inventory id inside the container.
|
protected IInventoryProvider |
inventoryProvider
Object containing this
MalisisInventory. |
protected net.minecraft.item.ItemStack |
itemStackProvider
ItemStack holding the inventory when inventoryProvider is an Item.
|
protected java.lang.String |
name
Name of this
MalisisInventory. |
protected int |
size
Number of slots inside this
MalisisInventory. |
protected int |
slotMaxStackSize
Maximum stack size for the slots.
|
protected MalisisSlot[] |
slots
Slots for this
MalisisInventory. |
InventoryState |
state
Current inventory state.
|
| Constructor and Description |
|---|
MalisisInventory(IInventoryProvider provider,
int size)
Instantiates a new
MalisisInventory. |
MalisisInventory(IInventoryProvider provider,
MalisisSlot[] slots)
Instantiates a new
MalisisInventory. |
| Modifier and Type | Method and Description |
|---|---|
void |
addOpenedContainer(MalisisInventoryContainer container)
Adds the opened container.
|
void |
breakInventory(net.minecraft.world.World world,
int x,
int y,
int z)
Spills out all the itemStack contained inside this
MalisisInventory. |
void |
closeChest()
Unused.
|
net.minecraft.item.ItemStack |
decrStackSize(int slot,
int count)
Unused : always returns null.
|
MalisisSlot |
getFirstOccupiedSlot()
Gets the first
MalisisSlot containing an ItemStack. |
int |
getInventoryId()
Gets the id of this
MalisisInventory inside the MalisisInventoryContainer. |
java.lang.String |
getInventoryName()
Gets the inventory name.
|
int |
getInventoryStackLimit()
Gets the inventory stack limit.
|
net.minecraft.item.ItemStack |
getItemStack(int slotNumber)
Gets the itemStack from the slot at position slotNumber.
|
java.util.List<net.minecraft.item.ItemStack> |
getItemStackList()
Gets the item stack list.
|
java.util.Set<MalisisInventoryContainer> |
getOpenedContainers()
Gets the opened containers.
|
IInventoryProvider |
getProvider()
Gets the
IInventoryProvider of this MalisisInventory. |
int |
getSizeInventory()
Gets the size inventory.
|
MalisisSlot |
getSlot(int slotNumber)
Gets the slot at position slotNumber.
|
MalisisSlot[] |
getSlots()
Gets the slots.
|
net.minecraft.item.ItemStack |
getStackInSlot(int slotNumber)
Deprecated.
|
net.minecraft.item.ItemStack |
getStackInSlotOnClosing(int slot)
Unused : always returns null.
|
boolean |
isCustomInventoryName()
Checks for custom inventory name.
|
boolean |
isEmpty()
Checks if at least one itemStack is present in inventory.
|
boolean |
isFull()
Checks if at least one slot is not full.
|
boolean |
isItemValidForSlot(int slotNumber,
net.minecraft.item.ItemStack itemStack)
Checks whether itemStack can be contained by the slot at position slotNumber.
|
boolean |
isUseableByPlayer(net.minecraft.entity.player.EntityPlayer player)
Unused.
|
boolean |
itemValidForSlot(MalisisSlot slot,
net.minecraft.item.ItemStack itemStack)
Checks whether itemStack can be contained by slot.
|
void |
markDirty()
Unused.
|
void |
onSlotChanged(MalisisSlot slot)
Called when itemStack change in slot.
|
static MalisisInventoryContainer |
open(net.minecraft.client.entity.EntityClientPlayerMP player,
IInventoryProvider inventoryProvider,
int windowId,
java.lang.Object... data)
Opens this
MalisisInventory. |
static MalisisInventoryContainer |
open(net.minecraft.entity.player.EntityPlayerMP player,
IInventoryProvider inventoryProvider,
java.lang.Object... data)
Opens this
MalisisInventory. |
void |
openChest()
Called when this
MalisisInventory is opened. |
void |
overrideSlot(MalisisSlot slot,
int slotNumber)
Overrides a specific slot with a new one.
|
net.minecraft.item.ItemStack |
pullItemStack()
Removes the first
ItemStack in this MalisisInventory and returns it. |
void |
readFromNBT(net.minecraft.nbt.NBTTagCompound tagCompound)
Reads this
MalisisInventory data from tagCompound. |
void |
register(java.lang.Object object)
Registers an object for the events fired by this
MalisisInventory. |
void |
removeOpenedContainer(MalisisInventoryContainer container)
Removes the opened container.
|
void |
setInventoryId(int id)
Sets the id of this
MalisisInventory inside its container. |
void |
setInventorySlotContents(int slotNumber,
net.minecraft.item.ItemStack itemStack)
Deprecated.
|
void |
setInventoryStackLimit(int limit)
Sets the inventory stack limit.
|
void |
setItemStack(int slotNumber,
net.minecraft.item.ItemStack itemStack)
Sets the itemStack for the slot at position slotNumber.
|
void |
setItemStackProvider(net.minecraft.item.ItemStack itemStack)
Set this
MalisisInventory contents based on the itemStack NBT. |
void |
setName(java.lang.String name)
Sets the name.
|
void |
setSlots(MalisisSlot[] slots)
Sets the slots for this
MalisisInventory. |
java.lang.String |
toString() |
net.minecraft.item.ItemStack |
transferInto(net.minecraft.item.ItemStack itemStack)
Transfers an
ItemStack inside this MalisisInventory. |
net.minecraft.item.ItemStack |
transferInto(net.minecraft.item.ItemStack itemStack,
boolean reversed)
Transfers itemStack inside this
MalisisInventory. |
protected net.minecraft.item.ItemStack |
transferInto(net.minecraft.item.ItemStack itemStack,
boolean emptySlot,
int start,
int end)
Transfer itemStack inside this
MalisisInventory into slots at position from start to end. |
void |
writeToNBT(net.minecraft.nbt.NBTTagCompound tagCompound)
Writes this
MalisisInventory data inside tagCompound. |
protected java.util.Set<MalisisInventoryContainer> containers
MalisisInventory that is currently containing this MalisisInventory.protected int inventoryId
protected IInventoryProvider inventoryProvider
MalisisInventory.protected net.minecraft.item.ItemStack itemStackProvider
protected MalisisSlot[] slots
MalisisInventory.protected java.lang.String name
MalisisInventory.protected int size
MalisisInventory.protected int slotMaxStackSize
public InventoryState state
public MalisisInventory(IInventoryProvider provider, int size)
MalisisInventory.provider - the providersize - the sizepublic MalisisInventory(IInventoryProvider provider, MalisisSlot[] slots)
MalisisInventory.provider - the providerslots - the slotspublic IInventoryProvider getProvider()
IInventoryProvider of this MalisisInventory.public void setSlots(MalisisSlot[] slots)
MalisisInventory.slots - the new slotspublic void overrideSlot(MalisisSlot slot, int slotNumber)
slot - the slotslotNumber - the slot numberpublic void register(java.lang.Object object)
MalisisInventory.object - the objectpublic void setInventoryId(int id)
MalisisInventory inside its container.id - the new inventory idpublic int getInventoryId()
MalisisInventory inside the MalisisInventoryContainer.public void setName(java.lang.String name)
name - the new namepublic java.lang.String getInventoryName()
getInventoryName in interface net.minecraft.inventory.IInventorypublic boolean isCustomInventoryName()
isCustomInventoryName in interface net.minecraft.inventory.IInventorypublic MalisisSlot getSlot(int slotNumber)
slotNumber - the slot numberpublic MalisisSlot[] getSlots()
MalisisInventory.public net.minecraft.item.ItemStack getItemStack(int slotNumber)
slotNumber - the slot numberpublic void setItemStack(int slotNumber,
net.minecraft.item.ItemStack itemStack)
slotNumber - the slot numberitemStack - the item stackpublic java.util.List<net.minecraft.item.ItemStack> getItemStackList()
public boolean itemValidForSlot(MalisisSlot slot, net.minecraft.item.ItemStack itemStack)
slot - the slotitemStack - the item stackpublic boolean isItemValidForSlot(int slotNumber,
net.minecraft.item.ItemStack itemStack)
isItemValidForSlot in interface net.minecraft.inventory.IInventoryslotNumber - the slot numberitemStack - the item stackpublic int getSizeInventory()
getSizeInventory in interface net.minecraft.inventory.IInventoryMalisisInventory.public int getInventoryStackLimit()
getInventoryStackLimit in interface net.minecraft.inventory.IInventorypublic void setInventoryStackLimit(int limit)
limit - the new inventory stack limitpublic void setItemStackProvider(net.minecraft.item.ItemStack itemStack)
MalisisInventory contents based on the itemStack NBT. itemStack - the new item stack providerpublic void addOpenedContainer(MalisisInventoryContainer container)
container - the containerpublic void removeOpenedContainer(MalisisInventoryContainer container)
container - the containerpublic java.util.Set<MalisisInventoryContainer> getOpenedContainers()
public boolean isEmpty()
public boolean isFull()
public void onSlotChanged(MalisisSlot slot)
slot - the slotpublic void openChest()
MalisisInventory is opened.openChest in interface net.minecraft.inventory.IInventorypublic MalisisSlot getFirstOccupiedSlot()
MalisisSlot containing an ItemStack.public net.minecraft.item.ItemStack pullItemStack()
ItemStack in this MalisisInventory and returns it.public net.minecraft.item.ItemStack transferInto(net.minecraft.item.ItemStack itemStack)
ItemStack inside this MalisisInventory.itemStack - the item stackpublic net.minecraft.item.ItemStack transferInto(net.minecraft.item.ItemStack itemStack,
boolean reversed)
MalisisInventory.itemStack - the item stackreversed - if true, start filling slots from the last slotprotected net.minecraft.item.ItemStack transferInto(net.minecraft.item.ItemStack itemStack,
boolean emptySlot,
int start,
int end)
MalisisInventory into slots at position from start to end. If start > end,
the slots will be filled backwards.itemStack - the item stackemptySlot - whether to fill empty slots onlystart - the startend - the endpublic void breakInventory(net.minecraft.world.World world,
int x,
int y,
int z)
MalisisInventory.world - the worldx - the xy - the yz - the zpublic void readFromNBT(net.minecraft.nbt.NBTTagCompound tagCompound)
MalisisInventory data from tagCompound.tagCompound - the tag compoundpublic void writeToNBT(net.minecraft.nbt.NBTTagCompound tagCompound)
MalisisInventory data inside tagCompound.tagCompound - the tag compoundpublic java.lang.String toString()
toString in class java.lang.Objectpublic static MalisisInventoryContainer open(net.minecraft.entity.player.EntityPlayerMP player, IInventoryProvider inventoryProvider, java.lang.Object... data)
MalisisInventory. Called server-side onlyplayer - the playerinventoryProvider - the inventory providerdata - the datapublic static MalisisInventoryContainer open(net.minecraft.client.entity.EntityClientPlayerMP player, IInventoryProvider inventoryProvider, int windowId, java.lang.Object... data)
MalisisInventory. Called client-side only.player - the playerinventoryProvider - the inventory providerwindowId - the window iddata - the datapublic boolean isUseableByPlayer(net.minecraft.entity.player.EntityPlayer player)
isUseableByPlayer in interface net.minecraft.inventory.IInventoryplayer - the playerpublic void closeChest()
closeChest in interface net.minecraft.inventory.IInventorypublic void markDirty()
markDirty in interface net.minecraft.inventory.IInventorypublic net.minecraft.item.ItemStack decrStackSize(int slot,
int count)
decrStackSize in interface net.minecraft.inventory.IInventoryslot - the slotcount - the countpublic net.minecraft.item.ItemStack getStackInSlotOnClosing(int slot)
getStackInSlotOnClosing in interface net.minecraft.inventory.IInventoryslot - the slot@Deprecated public net.minecraft.item.ItemStack getStackInSlot(int slotNumber)
getStackInSlot in interface net.minecraft.inventory.IInventoryslotNumber - the slot number@Deprecated
public void setInventorySlotContents(int slotNumber,
net.minecraft.item.ItemStack itemStack)
setInventorySlotContents in interface net.minecraft.inventory.IInventoryslotNumber - the slot numberitemStack - the item stack