endstone::PlayerInventory
Interface to the inventory of a Player , including the four armor slots and any extra slots.
Bases: endstone::Inventory
Functions:
Name | Description |
---|---|
getBoots | Return the ItemStack from the boots slot. |
getChestplate | Return the ItemStack from the chestplate slot. |
getHeldItemSlot | Get the slot number of the currently held item. |
getHelmet | Return the ItemStack from the helmet slot. |
getItemInMainHand | Gets the item the player is currently holding in their main hand. |
getItemInOffHand | Gets the item the player is currently holding in their off hand. |
getLeggings | Return the ItemStack from the leg slot. |
setBoots | Put the given ItemStack into the boots slot. |
setChestplate | Put the given ItemStack into the chestplate slot. |
setHeldItemSlot | Set the slot number of the currently held item. |
setHelmet | Put the given ItemStack into the helmet slot. |
setItemInMainHand | Sets the item the player is holding in their main hand. |
setItemInOffHand | Sets the item the player is holding in their off hand. |
setLeggings | Put the given ItemStack into the leggings slot. |
getBoots
std::unique_ptr<ItemStack> getBoots() const
Return the ItemStack from the boots slot.
Returns:
The ItemStack in the boots slot
getChestplate
std::unique_ptr<ItemStack> getChestplate() const
Return the ItemStack from the chestplate slot.
Returns:
The ItemStack in the chestplate slot
getHeldItemSlot
int getHeldItemSlot() const
Get the slot number of the currently held item.
Returns:
Held item slot number
getHelmet
std::unique_ptr<ItemStack> getHelmet() const
Return the ItemStack from the helmet slot.
Returns:
The ItemStack in the helmet slot
getItemInMainHand
std::unique_ptr<ItemStack> getItemInMainHand() const
Gets the item the player is currently holding in their main hand.
Returns:
the currently held item
getItemInOffHand
std::unique_ptr<ItemStack> getItemInOffHand() const
Gets the item the player is currently holding in their off hand.
Returns:
the currently held item
getLeggings
std::unique_ptr<ItemStack> getLeggings() const
Return the ItemStack from the leg slot.
Returns:
The ItemStack in the leg slot
setBoots
void setBoots(const ItemStack *boots)
Put the given ItemStack into the boots slot.
This does not check if the ItemStack is a pair of boots.
Parameters:
boots
The ItemStack to use as boots
setChestplate
void setChestplate(const ItemStack *chestplate)
Put the given ItemStack into the chestplate slot.
This does not check if the ItemStack is a chestplate.
Parameters:
chestplate
The ItemStack to use as chestplate
setHeldItemSlot
Result<void> setHeldItemSlot(int slot)
Set the slot number of the currently held item.
This validates whether the slot is between 0 and 8 inclusive.
Parameters:
slot
The new slot number
setHelmet
void setHelmet(const ItemStack *helmet)
Put the given ItemStack into the helmet slot.
This does not check if the ItemStack is a helmet.
Parameters:
helmet
The ItemStack to use as helmet
setItemInMainHand
void setItemInMainHand(const ItemStack *item)
Sets the item the player is holding in their main hand.
Parameters:
item
The item to put into the player’s hand
setItemInOffHand
void setItemInOffHand(const ItemStack *item)
Sets the item the player is holding in their off hand.
Parameters:
item
The item to put into the player’s hand
setLeggings
void setLeggings(const ItemStack *leggings)
Put the given ItemStack into the leggings slot.
This does not check if the ItemStack is a pair of leggings.
Parameters:
leggings
The ItemStack to use as leggings