public class PlayerInventory extends java.lang.Object implements IInventory, INameable
| Modifier and Type | Field and Description |
|---|---|
private java.util.List<NonNullList<ItemStack>> |
allInventories |
NonNullList<ItemStack> |
armorInventory |
int |
currentItem |
private ItemStack |
itemStack |
NonNullList<ItemStack> |
mainInventory |
NonNullList<ItemStack> |
offHandInventory |
PlayerEntity |
player |
private int |
timesChanged |
| Constructor and Description |
|---|
PlayerInventory(PlayerEntity playerIn) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcloseInventory, count, getInventoryStackLimit, hasAny, isItemValidForSlot, openInventoryclearObjgetCustomName, getDisplayName, hasCustomNamepublic final NonNullList<ItemStack> mainInventory
public final NonNullList<ItemStack> armorInventory
public final NonNullList<ItemStack> offHandInventory
private final java.util.List<NonNullList<ItemStack>> allInventories
public int currentItem
public final PlayerEntity player
private ItemStack itemStack
private int timesChanged
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)
private int storePartialItemStack(ItemStack itemStackIn)
private int addResource(int p_191973_1_,
ItemStack p_191973_2_)
public int storeItemStack(ItemStack itemStackIn)
public void tick()
public boolean addItemStackToInventory(ItemStack itemStackIn)
public boolean add(int slotIn,
ItemStack stack)
public ItemStack decrStackSize(int index, int count)
decrStackSize in interface IInventorypublic void deleteStack(ItemStack stack)
public ItemStack removeStackFromSlot(int index)
removeStackFromSlot in interface IInventorypublic void setInventorySlotContents(int index,
ItemStack stack)
setInventorySlotContents in interface IInventorypublic float getDestroySpeed(BlockState state)
public void read(ListNBT nbtTagListIn)
public int getSizeInventory()
getSizeInventory in interface IInventorypublic boolean isEmpty()
isEmpty in interface IInventorypublic ItemStack getStackInSlot(int index)
getStackInSlot in interface IInventorypublic ITextComponent getName()
public boolean canHarvestBlock(BlockState state)
public ItemStack armorItemInSlot(int slotIn)
public void damageArmor(float damage)
public void dropAllItems()
public void markDirty()
markDirty in interface IInventorypublic int getTimesChanged()
public void setItemStack(ItemStack itemStackIn)
public ItemStack getItemStack()
public boolean isUsableByPlayer(PlayerEntity player)
isUsableByPlayer in interface IInventorypublic boolean hasItemStack(ItemStack itemStackIn)
public void copyInventory(PlayerInventory playerInventory)
public void clear()
clear in interface IClearablepublic void accountStacks(RecipeItemHelper p_201571_1_)