Interface MainSpectatorInventory
- All Superinterfaces:
- Inventory, Iterable<ItemStack>, SpectatorInventory<PlayerInventorySlot>
- All Known Subinterfaces:
- MainInventory<NMS,- Self> 
A spectator inventory that contains all the items of the target player's 'normal' inventory.
This includes the player's armour, items in his crafting grid, and even the item on his cursor!
- 
Method SummaryModifier and TypeMethodDescriptionGet the items in the player's armour slots.Get the item that is on the player's cursor.default Mirror<PlayerInventorySlot> Get the mirror this inventory is viewed through.Get the items in the player's offhand.Get the items that are in the player's crafting slots.intGet the length of thegetPersonalContents()array.Get the items in the player's storage slots.voidsetArmourContents(ItemStack[] armourContents) Change the items in the player's armour slots.default voidsetContents(MainSpectatorInventory newContents) Set the contents of this inventory based on the contents from the provided inventory.voidsetCursorContents(ItemStack cursor) Set the item that is on the player's cursor.voidsetOffHandContents(ItemStack[] offHand) Set the items in the player's offhand.voidsetPersonalContents(ItemStack[] craftingContents) Set the items that are in the player's crafting slots.voidsetStorageContents(ItemStack[] storageContents) Set the items in the player's storage slots.Methods inherited from interface InventoryaddItem, all, all, clear, clear, close, contains, contains, contains, contains, containsAtLeast, first, first, firstEmpty, getContents, getHolder, getHolder, getItem, getLocation, getMaxStackSize, getSize, getType, getViewers, isEmpty, iterator, iterator, remove, remove, removeItem, removeItemAnySlot, setContents, setItem, setMaxStackSizeMethods inherited from interface IterableforEach, spliteratorMethods inherited from interface SpectatorInventorygetCreationOptions, getSpectatedPlayerId, getSpectatedPlayerName, getTitle
- 
Method Details- 
getStorageContentsItemStack[] getStorageContents()Get the items in the player's storage slots.- Specified by:
- getStorageContentsin interface- Inventory
 
- 
setStorageContentsSet the items in the player's storage slots.- Specified by:
- setStorageContentsin interface- Inventory
 
- 
getArmourContentsItemStack[] getArmourContents()Get the items in the player's armour slots.
- 
setArmourContentsChange the items in the player's armour slots.
- 
getOffHandContentsItemStack[] getOffHandContents()Get the items in the player's offhand. As per MC 1.21.6, this array includes the player's BODY and SADDLE items.
- 
setOffHandContentsSet the items in the player's offhand. The length of this array must be equal togetOffHandContents().length.
- 
setCursorContentsSet the item that is on the player's cursor.
- 
getCursorContentsItemStack getCursorContents()Get the item that is on the player's cursor.
- 
setPersonalContentsSet the items that are in the player's crafting slots. If the target player has an anvil/crafting table/enchanting table/villager workstation opened, then the contents of that temporary container will be updated instead.
- 
getPersonalContentsItemStack[] getPersonalContents()Get the items that are in the player's crafting slots. If the target player has an anvil/crafting/table/enchanting table/villager workstation opened, then the contents of that temporary container will be retrieved instead.
- 
getPersonalContentsSizeint getPersonalContentsSize()Get the length of thegetPersonalContents()array.
- 
getMirrorGet the mirror this inventory is viewed through.- Specified by:
- getMirrorin interface- SpectatorInventory<PlayerInventorySlot>
 
- 
setContentsSet the contents of this inventory based on the contents from the provided inventory.
 
-