public class InventoryBasic extends java.lang.Object implements IInventory
Constructor and Description |
---|
InventoryBasic(ITextComponent title,
int slotCount) |
InventoryBasic(java.lang.String title,
boolean customName,
int slotCount) |
Modifier and Type | Method and Description |
---|---|
void |
addInventoryChangeListener(IInventoryChangedListener listener)
Add a listener that will be notified when any item in this inventory is modified.
|
ItemStack |
addItem(ItemStack stack) |
void |
clear() |
void |
closeInventory(EntityPlayer player) |
ItemStack |
decrStackSize(int index,
int count)
Removes up to a specified number of items from an inventory slot and returns them in a new stack.
|
ITextComponent |
getDisplayName()
Get the formatted ChatComponent that will be used for the sender's username in chat
|
int |
getField(int id) |
int |
getFieldCount() |
int |
getInventoryStackLimit()
Returns the maximum stack size for a inventory slot.
|
java.lang.String |
getName()
Get the name of this object.
|
int |
getSizeInventory()
Returns the number of slots in the inventory.
|
ItemStack |
getStackInSlot(int index)
Returns the stack in the given slot.
|
boolean |
hasCustomName()
Returns true if this thing is named
|
boolean |
isEmpty() |
boolean |
isItemValidForSlot(int index,
ItemStack stack)
Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot.
|
boolean |
isUsableByPlayer(EntityPlayer player)
Don't rename this method to canInteractWith due to conflicts with Container
|
void |
markDirty()
For tile entities, ensures the chunk containing the tile entity is saved to disk later - the game won't think it
hasn't changed and skip it.
|
void |
openInventory(EntityPlayer player) |
void |
removeInventoryChangeListener(IInventoryChangedListener listener)
removes the specified IInvBasic from receiving further change notices
|
ItemStack |
removeStackFromSlot(int index)
Removes a stack from the given slot and returns it.
|
void |
setCustomName(java.lang.String inventoryTitleIn)
Sets the name of this inventory.
|
void |
setField(int id,
int value) |
void |
setInventorySlotContents(int index,
ItemStack stack)
Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
|
public InventoryBasic(java.lang.String title, boolean customName, int slotCount)
public InventoryBasic(ITextComponent title, int slotCount)
public void addInventoryChangeListener(IInventoryChangedListener listener)
public void removeInventoryChangeListener(IInventoryChangedListener listener)
public ItemStack getStackInSlot(int index)
getStackInSlot
in interface IInventory
public ItemStack decrStackSize(int index, int count)
decrStackSize
in interface IInventory
public ItemStack removeStackFromSlot(int index)
removeStackFromSlot
in interface IInventory
public void setInventorySlotContents(int index, ItemStack stack)
setInventorySlotContents
in interface IInventory
public int getSizeInventory()
getSizeInventory
in interface IInventory
public boolean isEmpty()
isEmpty
in interface IInventory
public java.lang.String getName()
getName
in interface IWorldNameable
public boolean hasCustomName()
hasCustomName
in interface IWorldNameable
public void setCustomName(java.lang.String inventoryTitleIn)
public ITextComponent getDisplayName()
getDisplayName
in interface IWorldNameable
public int getInventoryStackLimit()
getInventoryStackLimit
in interface IInventory
public void markDirty()
markDirty
in interface IInventory
public boolean isUsableByPlayer(EntityPlayer player)
isUsableByPlayer
in interface IInventory
public void openInventory(EntityPlayer player)
openInventory
in interface IInventory
public void closeInventory(EntityPlayer player)
closeInventory
in interface IInventory
public boolean isItemValidForSlot(int index, ItemStack stack)
isItemValidForSlot
in interface IInventory
public int getField(int id)
getField
in interface IInventory
public void setField(int id, int value)
setField
in interface IInventory
public int getFieldCount()
getFieldCount
in interface IInventory
public void clear()
clear
in interface IInventory