Skip to content

Class endstone::Item

ClassList > endstone > Item

Represents a base actor in the level.

  • #include <endstone/actor/item.h>

Inherits the following classes: endstone::Actor

Public Functions

Type Name
virtual std::unique_ptr< ItemStack > getItemStack () const = 0
Gets the item stack associated with this item drop.
virtual int getPickupDelay () const = 0
Gets the delay before this Item is available to be picked up by players.
virtual std::optional< std::int64_t > getThrower () const = 0
Get the thrower of this item.
virtual bool isUnlimitedLifetime () const = 0
Gets if this Item lives forever.
virtual void setItemStack (const ItemStack & stack) = 0
Sets the item stack associated with this item drop.
virtual void setPickupDelay (int delay) = 0
Sets the delay before this Item is available to be picked up by players.
virtual void setThrower (std::optional< std::int64_t > thrower) = 0
Set the thrower of this item.
virtual void setUnlimitedLifetime (bool unlimited) = 0
Sets if this Item should live forever.

Public Functions inherited from endstone::Actor

See endstone::Actor

Type Name
virtual bool addScoreboardTag (std::string tag) const = 0
Adds a tag to this actor.
virtual Item * asItem () const = 0
Gets an Actor asItem .
virtual Mob * asMob () const = 0
Gets an Actor asMob .
virtual Dimension & getDimension () const = 0
virtual int getHealth () const = 0
Gets the entity's health from 0 to its max possible value, where 0 is dead.
virtual std::int64_t getId () const = 0
Returns a unique id for this actor.
virtual Level & getLevel () const = 0
virtual Location getLocation () const = 0
virtual int getMaxHealth () const = 0
Gets the maximum health this entity has.
virtual std::string getNameTag () const = 0
Gets the current name tag of the actor.
virtual std::uint64_t getRuntimeId () const = 0
virtual std::string getScoreTag () const = 0
Gets the current score tag of the actor.
virtual std::vector< std::string > getScoreboardTags () const = 0
Returns a list of scoreboard tags for this actor.
virtual std::string getType () const = 0
Get the type of the actor.
virtual Vector< float > getVelocity () const = 0
virtual bool isDead () const = 0
Returns true if this actor has been marked for removal.
virtual bool isInLava () const = 0
virtual bool isInWater () const = 0
virtual bool isNameTagAlwaysVisible () const = 0
Checks if the actor's name tag is always visible.
virtual bool isNameTagVisible () const = 0
Checks if the actor's name tag is currently visible.
virtual bool isOnGround () const = 0
virtual bool isValid () const = 0
virtual void remove () = 0
virtual bool removeScoreboardTag (std::string tag) const = 0
Removes a given tag from this actor.
virtual Result< void > setHealth (int health) const = 0
virtual void setNameTag (std::string name) = 0
Sets the name tag for the actor.
virtual void setNameTagAlwaysVisible (bool visible) = 0
Sets whether the actor's name tag should always be visible.
virtual void setNameTagVisible (bool visible) = 0
Sets if the actor's name tag is visible or not.
virtual void setRotation (float yaw, float pitch) = 0
virtual void setScoreTag (std::string score) = 0
Sets the score tag for the actor.
virtual void teleport (Location location) = 0
virtual void teleport (Actor & target) = 0

Public Functions inherited from endstone::CommandSender

See endstone::CommandSender

Type Name
virtual Actor * asActor () const
Gets a CommandSender asActor .
virtual CommandSender * asCommandSender () override const
Casts a Permissible asCommandSender .
virtual ConsoleCommandSender * asConsole () const
Gets a CommandSender as Console.
virtual Player * asPlayer () const
Gets a CommandSender asPlayer .
virtual std::string getName () const = 0
Gets the name of this command sender.
virtual Server & getServer () const = 0
Returns the server instance that this command is running on.
virtual void sendErrorMessage (const Message & message) const = 0
Sends this sender a error message.
void sendErrorMessage (const fmt::format_string< Args... > format, Args &&... args) const
virtual void sendMessage (const Message & message) const = 0
Sends this sender a message.
void sendMessage (const fmt::format_string< Args... > format, Args &&... args) const

Public Functions inherited from endstone::Permissible

See endstone::Permissible

Type Name
virtual PermissionAttachment * addAttachment (Plugin & plugin, const std::string & name, bool value) = 0
Adds a new PermissionAttachment with a single permission by name and value.
virtual PermissionAttachment * addAttachment (Plugin & plugin) = 0
Adds a new empty PermissionAttachment to this object.
virtual CommandSender * asCommandSender () const = 0
Casts a Permissible asCommandSender .
virtual std::unordered_set< PermissionAttachmentInfo * > getEffectivePermissions () const = 0
Gets a set containing all the permissions currently in effect by this object.
virtual PermissionLevel getPermissionLevel () const = 0
Gets the permission level of this object.
virtual bool hasPermission (std::string name) const = 0
Gets the value of the specified permission, if set. If a permission override is not set on this object, the default value of the permission will be returned.
virtual bool hasPermission (const Permission & perm) const = 0
Gets the value of the specified permission, if set. If a permission override is not set on this object, the default value of the permission will be returned.
virtual bool isPermissionSet (std::string name) const = 0
Checks if this object contains an override for the specified permission, by fully qualified name.
virtual bool isPermissionSet (const Permission & perm) const = 0
Checks if this object contains an override for the specified Permission .
virtual void recalculatePermissions () = 0
Recalculates the permissions for this object, if the attachments have changed values. This should very rarely need to be called from a plugin.
virtual Result< void > removeAttachment (PermissionAttachment & attachment) = 0
Removes the given PermissionAttachment from this object.
virtual ~Permissible () = default

Public Functions Documentation

function getItemStack

Gets the item stack associated with this item drop.

virtual std::unique_ptr< ItemStack > endstone::Item::getItemStack () const = 0

Returns:

An item stack.


function getPickupDelay

Gets the delay before this Item is available to be picked up by players.

virtual int endstone::Item::getPickupDelay () const = 0

Returns:

Remaining delay


function getThrower

Get the thrower of this item.

virtual std::optional< std::int64_t > endstone::Item::getThrower () const = 0

Note:

The thrower is the entity which dropped the item.

Returns:

unique id of thrower


function isUnlimitedLifetime

Gets if this Item lives forever.

virtual bool endstone::Item::isUnlimitedLifetime () const = 0

Returns:

true if the lifetime is unlimited


function setItemStack

Sets the item stack associated with this item drop.

virtual void endstone::Item::setItemStack (
    const ItemStack & stack
) = 0

Parameters:

  • stack An item stack.

function setPickupDelay

Sets the delay before this Item is available to be picked up by players.

virtual void endstone::Item::setPickupDelay (
    int delay
) = 0

Parameters:

  • delay New delay

function setThrower

Set the thrower of this item.

virtual void endstone::Item::setThrower (
    std::optional< std::int64_t > thrower
) = 0

Note:

The thrower is the entity which dropped the item.

Parameters:

  • thrower unique id of thrower

function setUnlimitedLifetime

Sets if this Item should live forever.

virtual void endstone::Item::setUnlimitedLifetime (
    bool unlimited
) = 0

Parameters:

  • unlimited true if the lifetime is unlimited


The documentation for this class was generated from the following file include/endstone/actor/item.h