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 Summary
Modifier 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 Inventory
addItem, 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 Iterable
forEach, spliteratorMethods inherited from interface SpectatorInventory
getCreationOptions, getSpectatedPlayerId, getSpectatedPlayerName, getTitle
-
Method Details
-
getStorageContents
ItemStack[] getStorageContents()Get the items in the player's storage slots.- Specified by:
getStorageContentsin interfaceInventory
-
setStorageContents
Set the items in the player's storage slots.- Specified by:
setStorageContentsin interfaceInventory
-
getArmourContents
ItemStack[] getArmourContents()Get the items in the player's armour slots. -
setArmourContents
Change the items in the player's armour slots. -
getOffHandContents
ItemStack[] 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. -
setOffHandContents
Set the items in the player's offhand. The length of this array must be equal togetOffHandContents().length. -
setCursorContents
Set the item that is on the player's cursor. -
getCursorContents
ItemStack getCursorContents()Get the item that is on the player's cursor. -
setPersonalContents
Set 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. -
getPersonalContents
ItemStack[] 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. -
getPersonalContentsSize
int getPersonalContentsSize()Get the length of thegetPersonalContents()array. -
getMirror
Get the mirror this inventory is viewed through.- Specified by:
getMirrorin interfaceSpectatorInventory<PlayerInventorySlot>
-
setContents
Set the contents of this inventory based on the contents from the provided inventory.
-