public class InventoryPlayer extends java.lang.Object implements IInventory
| Modifier and Type | Field and Description |
|---|---|
ItemStack[] |
armorInventory
An array of 4 item stacks containing the currently worn armor pieces.
|
int |
currentItem
The index of the currently held item (0-8).
|
boolean |
inventoryChanged
Set true whenever the inventory changes.
|
ItemStack[] |
mainInventory
An array of 36 item stacks indicating the main player inventory (including the visible bar).
|
EntityPlayer |
player
The player whose inventory this is.
|
| Constructor and Description |
|---|
InventoryPlayer(EntityPlayer p_i1750_1_) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addItemStackToInventory(ItemStack p_70441_1_)
Adds the item stack to the inventory, returns false if it is impossible.
|
ItemStack |
armorItemInSlot(int p_70440_1_)
returns a player armor item (as itemstack) contained in specified armor slot.
|
void |
changeCurrentItem(int p_70453_1_)
Switch the current item to the next one or the previous one
|
int |
clearInventory(Item p_146027_1_,
int p_146027_2_)
Clear this player's inventory (including armor), using the specified Item and metadata as filters or -1 for no
filter.
|
void |
closeInventory() |
boolean |
consumeInventoryItem(Item p_146026_1_)
removed one item of specified Item from inventory (if it is in a stack, the stack size will reduce with 1)
|
void |
copyInventory(InventoryPlayer p_70455_1_)
Copy the ItemStack contents from another InventoryPlayer instance
|
void |
damageArmor(float p_70449_1_)
Damages armor in each slot by the specified amount.
|
void |
decrementAnimations()
Decrement the number of animations remaining.
|
ItemStack |
decrStackSize(int p_70298_1_,
int p_70298_2_)
Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a
new stack.
|
void |
dropAllItems()
Drop all armor and main inventory items.
|
float |
func_146023_a(Block p_146023_1_) |
boolean |
func_146025_b(Block p_146025_1_) |
void |
func_146030_a(Item p_146030_1_,
int p_146030_2_,
boolean p_146030_3_,
boolean p_146030_4_) |
void |
func_70439_a(Item p_70439_1_,
int p_70439_2_) |
ItemStack |
getCurrentItem()
Returns the item stack currently held by the player.
|
int |
getFirstEmptyStack()
Returns the first item stack that is empty.
|
static int |
getHotbarSize()
Get the size of the player hotbar inventory
|
java.lang.String |
getInventoryName()
Returns the name of the inventory
|
int |
getInventoryStackLimit()
Returns the maximum stack size for a inventory slot.
|
ItemStack |
getItemStack() |
int |
getSizeInventory()
Returns the number of slots in the inventory.
|
ItemStack |
getStackInSlot(int p_70301_1_)
Returns the stack in slot i
|
ItemStack |
getStackInSlotOnClosing(int p_70304_1_)
When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem -
like when you close a workbench GUI.
|
int |
getTotalArmorValue()
Based on the damage values and maximum damage values of each armor item, returns the current armor value.
|
boolean |
hasCustomInventoryName()
Returns if the inventory is named
|
boolean |
hasItem(Item p_146028_1_)
Checks if a specified Item is inside the inventory
|
boolean |
hasItemStack(ItemStack p_70431_1_)
Returns true if the specified ItemStack exists in the inventory.
|
boolean |
isItemValidForSlot(int p_94041_1_,
ItemStack p_94041_2_)
Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot.
|
boolean |
isUseableByPlayer(EntityPlayer p_70300_1_)
Do not make give this method the name canInteractWith because it clashes 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() |
void |
readFromNBT(NBTTagList p_70443_1_)
Reads from the given tag list and fills the slots in the inventory with the correct items.
|
void |
setInventorySlotContents(int p_70299_1_,
ItemStack p_70299_2_)
Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
|
void |
setItemStack(ItemStack p_70437_1_) |
NBTTagList |
writeToNBT(NBTTagList p_70442_1_)
Writes the inventory out as a list of compound tags.
|
public ItemStack[] mainInventory
public ItemStack[] armorInventory
public int currentItem
public EntityPlayer player
public boolean inventoryChanged
public InventoryPlayer(EntityPlayer p_i1750_1_)
public ItemStack getCurrentItem()
public static int getHotbarSize()
public int getFirstEmptyStack()
public void func_146030_a(Item p_146030_1_, int p_146030_2_, boolean p_146030_3_, boolean p_146030_4_)
public int clearInventory(Item p_146027_1_, int p_146027_2_)
public void changeCurrentItem(int p_70453_1_)
public void func_70439_a(Item p_70439_1_, int p_70439_2_)
public void decrementAnimations()
public boolean consumeInventoryItem(Item p_146026_1_)
public boolean hasItem(Item p_146028_1_)
public boolean addItemStackToInventory(ItemStack p_70441_1_)
public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_)
decrStackSize in interface IInventorypublic ItemStack getStackInSlotOnClosing(int p_70304_1_)
getStackInSlotOnClosing in interface IInventorypublic void setInventorySlotContents(int p_70299_1_,
ItemStack p_70299_2_)
setInventorySlotContents in interface IInventorypublic float func_146023_a(Block p_146023_1_)
public NBTTagList writeToNBT(NBTTagList p_70442_1_)
public void readFromNBT(NBTTagList p_70443_1_)
public int getSizeInventory()
getSizeInventory in interface IInventorypublic ItemStack getStackInSlot(int p_70301_1_)
getStackInSlot in interface IInventorypublic java.lang.String getInventoryName()
getInventoryName in interface IInventorypublic boolean hasCustomInventoryName()
hasCustomInventoryName in interface IInventorypublic int getInventoryStackLimit()
getInventoryStackLimit in interface IInventorypublic boolean func_146025_b(Block p_146025_1_)
public ItemStack armorItemInSlot(int p_70440_1_)
public int getTotalArmorValue()
public void damageArmor(float p_70449_1_)
public void dropAllItems()
public void markDirty()
markDirty in interface IInventorypublic void setItemStack(ItemStack p_70437_1_)
public ItemStack getItemStack()
public boolean isUseableByPlayer(EntityPlayer p_70300_1_)
isUseableByPlayer in interface IInventorypublic boolean hasItemStack(ItemStack p_70431_1_)
public void openInventory()
openInventory in interface IInventorypublic void closeInventory()
closeInventory in interface IInventorypublic boolean isItemValidForSlot(int p_94041_1_,
ItemStack p_94041_2_)
isItemValidForSlot in interface IInventorypublic void copyInventory(InventoryPlayer p_70455_1_)