Package net.minecraft.entity.player
Class PlayerInventory
- java.lang.Object
-
- net.minecraft.entity.player.PlayerInventory
-
- All Implemented Interfaces:
IClearable
,IInventory
,INameable
public class PlayerInventory extends java.lang.Object implements IInventory, INameable
-
-
Field Summary
Fields Modifier and Type Field Description NonNullList<ItemStack>
armor
private ItemStack
carried
private java.util.List<NonNullList<ItemStack>>
compartments
NonNullList<ItemStack>
items
NonNullList<ItemStack>
offhand
PlayerEntity
player
int
selected
private int
timesChanged
-
Constructor Summary
Constructors Constructor Description PlayerInventory(PlayerEntity p_i1750_1_)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(int p_191971_1_, ItemStack p_191971_2_)
boolean
add(ItemStack p_70441_1_)
private int
addResource(int p_191973_1_, ItemStack p_191973_2_)
private int
addResource(ItemStack p_70452_1_)
void
clearContent()
int
clearOrCountMatchingItems(java.util.function.Predicate<ItemStack> p_234564_1_, int p_234564_2_, IInventory p_234564_3_)
boolean
contains(ItemStack p_70431_1_)
boolean
contains(ITag<Item> p_199712_1_)
void
dropAll()
void
fillStackedContents(RecipeItemHelper p_201571_1_)
int
findSlotMatchingItem(ItemStack p_184429_1_)
int
findSlotMatchingUnusedItem(ItemStack p_194014_1_)
ItemStack
getArmor(int p_70440_1_)
ItemStack
getCarried()
int
getContainerSize()
float
getDestroySpeed(BlockState p_184438_1_)
int
getFreeSlot()
ItemStack
getItem(int p_70301_1_)
ITextComponent
getName()
ItemStack
getSelected()
static int
getSelectionSize()
int
getSlotWithRemainingSpace(ItemStack p_70432_1_)
int
getSuitableHotbarSlot()
int
getTimesChanged()
private boolean
hasRemainingSpaceForItem(ItemStack p_184436_1_, ItemStack p_184436_2_)
void
hurtArmor(DamageSource p_234563_1_, float p_234563_2_)
boolean
isEmpty()
static boolean
isHotbarSlot(int p_184435_0_)
private boolean
isSameItem(ItemStack p_184431_1_, ItemStack p_184431_2_)
void
load(ListNBT p_70443_1_)
void
pickSlot(int p_184430_1_)
void
placeItemBackInInventory(World p_191975_1_, ItemStack p_191975_2_)
ItemStack
removeItem(int p_70298_1_, int p_70298_2_)
void
removeItem(ItemStack p_184437_1_)
ItemStack
removeItemNoUpdate(int p_70304_1_)
void
replaceWith(PlayerInventory p_70455_1_)
ListNBT
save(ListNBT p_70442_1_)
void
setCarried(ItemStack p_70437_1_)
void
setChanged()
void
setItem(int p_70299_1_, ItemStack p_70299_2_)
void
setPickedItem(ItemStack p_184434_1_)
boolean
stillValid(PlayerEntity p_70300_1_)
void
swapPaint(double p_195409_1_)
void
tick()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.minecraft.inventory.IInventory
canPlaceItem, countItem, getMaxStackSize, hasAnyOf, startOpen, stopOpen
-
Methods inherited from interface net.minecraft.util.INameable
getCustomName, getDisplayName, hasCustomName
-
-
-
-
Field Detail
-
items
public final NonNullList<ItemStack> items
-
armor
public final NonNullList<ItemStack> armor
-
offhand
public final NonNullList<ItemStack> offhand
-
compartments
private final java.util.List<NonNullList<ItemStack>> compartments
-
selected
public int selected
-
player
public final PlayerEntity player
-
carried
private ItemStack carried
-
timesChanged
private int timesChanged
-
-
Constructor Detail
-
PlayerInventory
public PlayerInventory(PlayerEntity p_i1750_1_)
-
-
Method Detail
-
getSelected
public ItemStack getSelected()
-
getSelectionSize
public static int getSelectionSize()
-
hasRemainingSpaceForItem
private boolean hasRemainingSpaceForItem(ItemStack p_184436_1_, ItemStack p_184436_2_)
-
getFreeSlot
public int getFreeSlot()
-
setPickedItem
public void setPickedItem(ItemStack p_184434_1_)
-
pickSlot
public void pickSlot(int p_184430_1_)
-
isHotbarSlot
public static boolean isHotbarSlot(int p_184435_0_)
-
findSlotMatchingItem
public int findSlotMatchingItem(ItemStack p_184429_1_)
-
findSlotMatchingUnusedItem
public int findSlotMatchingUnusedItem(ItemStack p_194014_1_)
-
getSuitableHotbarSlot
public int getSuitableHotbarSlot()
-
swapPaint
public void swapPaint(double p_195409_1_)
-
clearOrCountMatchingItems
public int clearOrCountMatchingItems(java.util.function.Predicate<ItemStack> p_234564_1_, int p_234564_2_, IInventory p_234564_3_)
-
addResource
private int addResource(ItemStack p_70452_1_)
-
addResource
private int addResource(int p_191973_1_, ItemStack p_191973_2_)
-
getSlotWithRemainingSpace
public int getSlotWithRemainingSpace(ItemStack p_70432_1_)
-
tick
public void tick()
-
add
public boolean add(ItemStack p_70441_1_)
-
add
public boolean add(int p_191971_1_, ItemStack p_191971_2_)
-
placeItemBackInInventory
public void placeItemBackInInventory(World p_191975_1_, ItemStack p_191975_2_)
-
removeItem
public ItemStack removeItem(int p_70298_1_, int p_70298_2_)
- Specified by:
removeItem
in interfaceIInventory
-
removeItem
public void removeItem(ItemStack p_184437_1_)
-
removeItemNoUpdate
public ItemStack removeItemNoUpdate(int p_70304_1_)
- Specified by:
removeItemNoUpdate
in interfaceIInventory
-
setItem
public void setItem(int p_70299_1_, ItemStack p_70299_2_)
- Specified by:
setItem
in interfaceIInventory
-
getDestroySpeed
public float getDestroySpeed(BlockState p_184438_1_)
-
load
public void load(ListNBT p_70443_1_)
-
getContainerSize
public int getContainerSize()
- Specified by:
getContainerSize
in interfaceIInventory
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceIInventory
-
getItem
public ItemStack getItem(int p_70301_1_)
- Specified by:
getItem
in interfaceIInventory
-
getName
public ITextComponent getName()
-
getArmor
public ItemStack getArmor(int p_70440_1_)
-
hurtArmor
public void hurtArmor(DamageSource p_234563_1_, float p_234563_2_)
-
dropAll
public void dropAll()
-
setChanged
public void setChanged()
- Specified by:
setChanged
in interfaceIInventory
-
getTimesChanged
public int getTimesChanged()
-
setCarried
public void setCarried(ItemStack p_70437_1_)
-
getCarried
public ItemStack getCarried()
-
stillValid
public boolean stillValid(PlayerEntity p_70300_1_)
- Specified by:
stillValid
in interfaceIInventory
-
contains
public boolean contains(ItemStack p_70431_1_)
-
replaceWith
public void replaceWith(PlayerInventory p_70455_1_)
-
clearContent
public void clearContent()
- Specified by:
clearContent
in interfaceIClearable
-
fillStackedContents
public void fillStackedContents(RecipeItemHelper p_201571_1_)
-
-