public class PlayerInventory extends java.lang.Object implements IInventory, INameable
修飾子とタイプ | フィールドと説明 |
---|---|
NonNullList<ItemStack> |
armorInventory |
int |
currentItem |
NonNullList<ItemStack> |
mainInventory |
NonNullList<ItemStack> |
offHandInventory |
PlayerEntity |
player |
コンストラクタと説明 |
---|
PlayerInventory(PlayerEntity playerIn) |
修飾子とタイプ | メソッドと説明 |
---|---|
void |
accountStacks(RecipeItemHelper p_201571_1_) |
boolean |
add(int slotIn,
ItemStack stack)
Adds the stack to the specified slot in the player's inventory.
|
boolean |
addItemStackToInventory(ItemStack itemStackIn)
Adds the stack to the first empty slot in the player's inventory.
|
ItemStack |
armorItemInSlot(int slotIn)
returns a player armor item (as itemstack) contained in specified armor slot.
|
boolean |
canHarvestBlock(BlockState state) |
void |
changeCurrentItem(double direction) |
void |
clear() |
int |
clearMatchingItems(java.util.function.Predicate<ItemStack> p_195408_1_,
int count) |
void |
copyInventory(PlayerInventory playerInventory)
Copy the ItemStack contents from another InventoryPlayer instance
|
void |
damageArmor(float damage)
Damages armor in each slot by the specified amount.
|
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.
|
void |
deleteStack(ItemStack stack) |
void |
dropAllItems()
Drop all armor and main inventory items.
|
int |
findSlotMatchingUnusedItem(ItemStack p_194014_1_) |
int |
getBestHotbarSlot() |
ItemStack |
getCurrentItem()
Returns the item stack currently held by the player.
|
float |
getDestroySpeed(BlockState state) |
int |
getFirstEmptyStack()
Returns the first item stack that is empty.
|
static int |
getHotbarSize()
Get the size of the player hotbar inventory
|
ItemStack |
getItemStack()
Stack helds by mouse, used in GUI and Containers
|
ITextComponent |
getName() |
int |
getSizeInventory()
Returns the number of slots in the inventory.
|
int |
getSlotFor(ItemStack stack)
Finds the stack or an equivalent one in the main inventory
|
ItemStack |
getStackInSlot(int index)
Returns the stack in the given slot.
|
int |
getTimesChanged() |
boolean |
hasItemStack(ItemStack itemStackIn)
Returns true if the specified ItemStack exists in the inventory.
|
boolean |
hasTag(Tag<Item> itemTag) |
boolean |
isEmpty() |
static boolean |
isHotbar(int index) |
boolean |
isUsableByPlayer(PlayerEntity 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 |
pickItem(int index) |
void |
placeItemBackInInventory(World worldIn,
ItemStack stack) |
void |
read(ListNBT nbtTagListIn)
Reads from the given tag list and fills the slots in the inventory with the correct items.
|
ItemStack |
removeStackFromSlot(int index)
Removes a stack from the given slot and returns it.
|
void |
setInventorySlotContents(int index,
ItemStack stack)
Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
|
void |
setItemStack(ItemStack itemStackIn)
Set the stack helds by mouse, used in GUI/Container
|
void |
setPickedItemStack(ItemStack stack) |
int |
storeItemStack(ItemStack itemStackIn)
Stores a stack in the player's inventory.
|
void |
tick()
Decrement the number of animations remaining.
|
ListNBT |
write(ListNBT nbtTagListIn)
Writes the inventory out as a list of compound tags.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
closeInventory, count, getInventoryStackLimit, hasAny, isItemValidForSlot, openInventory
clearObj
getCustomName, getDisplayName, hasCustomName
public final NonNullList<ItemStack> mainInventory
public final NonNullList<ItemStack> armorInventory
public final NonNullList<ItemStack> offHandInventory
public int currentItem
public final PlayerEntity player
public PlayerInventory(PlayerEntity playerIn)
public ItemStack getCurrentItem()
public static int getHotbarSize()
public int getFirstEmptyStack()
public void setPickedItemStack(ItemStack stack)
public void pickItem(int index)
public static boolean isHotbar(int index)
public int getSlotFor(ItemStack stack)
public int findSlotMatchingUnusedItem(ItemStack p_194014_1_)
public int getBestHotbarSlot()
public void changeCurrentItem(double direction)
public int clearMatchingItems(java.util.function.Predicate<ItemStack> p_195408_1_, int count)
public int storeItemStack(ItemStack itemStackIn)
public void tick()
public boolean addItemStackToInventory(ItemStack itemStackIn)
false
if it's not possible to
place the entire stack in the inventory.public boolean add(int slotIn, ItemStack stack)
false
if it's not possible to
place the entire stack in the inventory.public ItemStack decrStackSize(int index, int count)
decrStackSize
インタフェース内 IInventory
public void deleteStack(ItemStack stack)
public ItemStack removeStackFromSlot(int index)
removeStackFromSlot
インタフェース内 IInventory
public void setInventorySlotContents(int index, ItemStack stack)
setInventorySlotContents
インタフェース内 IInventory
public float getDestroySpeed(BlockState state)
public ListNBT write(ListNBT nbtTagListIn)
public void read(ListNBT nbtTagListIn)
public int getSizeInventory()
getSizeInventory
インタフェース内 IInventory
public boolean isEmpty()
isEmpty
インタフェース内 IInventory
public ItemStack getStackInSlot(int index)
getStackInSlot
インタフェース内 IInventory
public ITextComponent getName()
public boolean canHarvestBlock(BlockState state)
public ItemStack armorItemInSlot(int slotIn)
public void damageArmor(float damage)
public void dropAllItems()
public void markDirty()
markDirty
インタフェース内 IInventory
public int getTimesChanged()
public void setItemStack(ItemStack itemStackIn)
public ItemStack getItemStack()
public boolean isUsableByPlayer(PlayerEntity player)
isUsableByPlayer
インタフェース内 IInventory
public boolean hasItemStack(ItemStack itemStackIn)
public void copyInventory(PlayerInventory playerInventory)
public void clear()
clear
インタフェース内 IClearable
public void accountStacks(RecipeItemHelper p_201571_1_)