Class Inventory
java.lang.Object
net.minecraft.world.entity.player.Inventory
- All Implemented Interfaces:
Iterable<ItemStack>, Clearable, Container, SlotProvider, Nameable, ContainerExtension
-
Nested Class Summary
Nested classes/interfaces inherited from interface Container
Container.ContainerIterator -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Componentprivate final EntityEquipmentstatic final it.unimi.dsi.fastutil.ints.Int2ObjectMap<EquipmentSlot> static final intprivate final NonNullList<ItemStack> static final intfinal Playerstatic final intprivate intstatic final intstatic final intstatic final intstatic final intprivate intFields inherited from interface Container
DEFAULT_DISTANCE_BUFFER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanvoidaddAndPickItem(ItemStack itemStack) private intaddResource(int slot, ItemStack itemStack) private intaddResource(ItemStack itemStack) voidintclearOrCountMatchingItems(Predicate<ItemStack> predicate, int amountToRemove, Container craftSlots) booleanbooleanbooleancreateInventoryUpdatePacket(int slot) voiddropAll()voidfillStackedContents(StackedItemContents contents) intfindSlotMatchingCraftingIngredient(Holder<Item> item, ItemStack existingItem) intfindSlotMatchingItem(ItemStack itemStack) intintgetItem(int slot) getName()intstatic intintgetSlotWithRemainingSpace(ItemStack newItemStack) intintprivate booleanhasRemainingSpaceForItem(ItemStack slotItemStack, ItemStack newItemStack) booleanisEmpty()static booleanisHotbarSlot(int slot) static booleanisUsableForCrafting(ItemStack item) voidvoidpickSlot(int slot) voidplaceItemBackInInventory(ItemStack itemStack) voidplaceItemBackInInventory(ItemStack itemStack, boolean shouldSendSetSlotPacket) removeFromSelected(boolean all) removeItem(int slot, int count) voidremoveItem(ItemStack itemStack) removeItemNoUpdate(int slot) voidreplaceWith(Inventory other) voidvoidvoidsetSelectedItem(ItemStack itemStack) voidsetSelectedSlot(int selected) booleanstillValid(Player player) voidtick()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Container
canPlaceItem, canTakeItem, countItem, getEntitiesWithContainerOpen, getMaxStackSize, getMaxStackSize, getSlot, hasAnyMatching, hasAnyOf, iterator, startOpen, stopOpenMethods inherited from interface ContainerExtension
onTransfer, setItemMethods inherited from interface Iterable
forEach, spliteratorMethods inherited from interface Nameable
getCustomName, getDisplayName, getPlainTextName, hasCustomNameMethods inherited from interface SlotProvider
getSlotsFromRange
-
Field Details
-
POP_TIME_DURATION
public static final int POP_TIME_DURATION- See Also:
-
INVENTORY_SIZE
public static final int INVENTORY_SIZE- See Also:
-
SELECTION_SIZE
public static final int SELECTION_SIZE- See Also:
-
SLOT_OFFHAND
public static final int SLOT_OFFHAND- See Also:
-
SLOT_BODY_ARMOR
public static final int SLOT_BODY_ARMOR- See Also:
-
SLOT_SADDLE
public static final int SLOT_SADDLE- See Also:
-
NOT_FOUND_INDEX
public static final int NOT_FOUND_INDEX- See Also:
-
EQUIPMENT_SLOT_MAPPING
-
DEFAULT_NAME
-
items
-
selected
private int selected -
player
-
equipment
-
timesChanged
private int timesChanged
-
-
Constructor Details
-
Inventory
-
-
Method Details
-
getSelectedSlot
public int getSelectedSlot() -
setSelectedSlot
public void setSelectedSlot(int selected) -
getSelectedItem
-
setSelectedItem
-
getSelectionSize
public static int getSelectionSize() -
getNonEquipmentItems
-
hasRemainingSpaceForItem
-
getFreeSlot
public int getFreeSlot() -
addAndPickItem
-
pickSlot
public void pickSlot(int slot) -
isHotbarSlot
public static boolean isHotbarSlot(int slot) -
findSlotMatchingItem
-
isUsableForCrafting
-
findSlotMatchingCraftingIngredient
-
getSuitableHotbarSlot
public int getSuitableHotbarSlot() -
clearOrCountMatchingItems
-
addResource
-
addResource
-
getSlotWithRemainingSpace
-
tick
public void tick() -
add
-
add
-
placeItemBackInInventory
-
placeItemBackInInventory
-
createInventoryUpdatePacket
-
removeItem
- Specified by:
removeItemin interfaceContainer
-
removeItem
-
removeItemNoUpdate
- Specified by:
removeItemNoUpdatein interfaceContainer
-
setItem
-
save
-
load
-
getContainerSize
public int getContainerSize()- Specified by:
getContainerSizein interfaceContainer
-
isEmpty
-
getItem
-
getName
-
dropAll
public void dropAll() -
setChanged
public void setChanged()- Specified by:
setChangedin interfaceContainer
-
getTimesChanged
public int getTimesChanged() -
stillValid
- Specified by:
stillValidin interfaceContainer
-
contains
-
contains
-
contains
-
replaceWith
-
clearContent
public void clearContent()- Specified by:
clearContentin interfaceClearable
-
fillStackedContents
-
removeFromSelected
-