Skip to content

Class endstone::Actor

ClassList > endstone > Actor

Represents a base actor in the level.

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

Inherits the following classes: endstone::CommandSender

Inherited by the following classes: endstone::Item, endstone::Mob

Public Functions

Type Name
virtual bool addScoreboardTag (std::string tag) const = 0
Adds a tag to this actor.
virtual Dimension & getDimension () const = 0
Gets the current Dimension this actor resides in.
virtual std::int64_t getId () const = 0
Returns a unique id for this actor.
virtual Level & getLevel () const = 0
Gets the current Level this actor resides in.
virtual Location getLocation () const = 0
Gets the actor's current position.
virtual std::string getNameTag () const = 0
Gets the current name tag of the actor.
virtual std::uint64_t getRuntimeId () const = 0
Returns the runtime id for this actor.
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 const ActorType & getType () const = 0
Get the type of the actor.
virtual Vector getVelocity () const = 0
Gets this actor's current velocity.
virtual bool isDead () const = 0
Returns true if this actor has been marked for removal.
virtual bool isInLava () const = 0
Returns true if the actor is in lava.
virtual bool isInWater () const = 0
Returns true if the actor is in water.
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
Returns true if the actor is supported by a block.
virtual bool isValid () const = 0
Returns false if the entity has died, been despawned for some other reason, or has not been added to the level.
virtual void remove () = 0
Remove this actor from the level.
virtual bool removeScoreboardTag (std::string tag) const = 0
Removes a given tag from this actor.
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
Sets the actor's rotation.
virtual void setScoreTag (std::string score) = 0
Sets the score tag for the actor.
virtual bool teleport (const Location & location) = 0
Teleports this actor to the given location.
virtual bool teleport (const Actor & target) = 0
Teleports this actor to the target Actor .

Public Functions inherited from endstone::CommandSender

See endstone::CommandSender

Type Name
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 std::format_string< Args... > format, Args &&... args) const
virtual void sendMessage (const Message & message) const = 0
Sends this sender a message.
void sendMessage (const std::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 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.
virtual bool hasPermission (const Permission & perm) const = 0
Gets the value of the specified permission, if set.
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.
virtual bool removeAttachment (PermissionAttachment & attachment) = 0
Removes the given PermissionAttachment from this object.

Public Functions inherited from endstone::Object

See endstone::Object

Type Name
T * as ()
Attempts to cast this object to the given type T.
const T * as () const
Attempts to cast this object to the given type T.
virtual const std::type_info & getClassTypeId () const = 0
bool is () const
Checks if this object is an instance of the given type T (or a subclass of T).
virtual bool isInstanceOf (const std::type_info & target) const = 0
virtual ~Object () = default

Public Functions Documentation

function addScoreboardTag

Adds a tag to this actor.

virtual bool endstone::Actor::addScoreboardTag (
    std::string tag
) const = 0

Parameters:

  • tag the tag to add

Returns:

true if the tag was successfully added, false if the tag already exists.


function getDimension

Gets the current Dimension this actor resides in.

virtual Dimension & endstone::Actor::getDimension () const = 0

Returns:

The current Dimension this actor resides in


function getId

Returns a unique id for this actor.

virtual std::int64_t endstone::Actor::getId () const = 0

Returns:

Actor id


function getLevel

Gets the current Level this actor resides in.

virtual Level & endstone::Actor::getLevel () const = 0

Returns:

The current Level this actor resides in


function getLocation

Gets the actor's current position.

virtual Location endstone::Actor::getLocation () const = 0

Returns:

a new copy of Location containing the position of this actor


function getNameTag

Gets the current name tag of the actor.

virtual std::string endstone::Actor::getNameTag () const = 0

Returns:

The name tag.


function getRuntimeId

Returns the runtime id for this actor.

virtual std::uint64_t endstone::Actor::getRuntimeId () const = 0

Returns:

Runtime id for this actor


function getScoreTag

Gets the current score tag of the actor.

virtual std::string endstone::Actor::getScoreTag () const = 0

Returns:

The score tag.


function getScoreboardTags

Returns a list of scoreboard tags for this actor.

virtual std::vector< std::string > endstone::Actor::getScoreboardTags () const = 0

Returns:

a list of scoreboard tags for this actor


function getType

Get the type of the actor.

virtual const  ActorType & endstone::Actor::getType () const = 0

Returns:

The type of the actor.


function getVelocity

Gets this actor's current velocity.

virtual Vector endstone::Actor::getVelocity () const = 0

Returns:

Current traveling velocity of this actor


function isDead

Returns true if this actor has been marked for removal.

virtual bool endstone::Actor::isDead () const = 0

Returns:

True if it is dead.


function isInLava

Returns true if the actor is in lava.

virtual bool endstone::Actor::isInLava () const = 0

Returns:

True if the actor is in lava.


function isInWater

Returns true if the actor is in water.

virtual bool endstone::Actor::isInWater () const = 0

Returns:

True if the actor is in water.


function isNameTagAlwaysVisible

Checks if the actor's name tag is always visible.

virtual bool endstone::Actor::isNameTagAlwaysVisible () const = 0

Returns:

True if the name tag is always visible, false otherwise.


function isNameTagVisible

Checks if the actor's name tag is currently visible.

virtual bool endstone::Actor::isNameTagVisible () const = 0

Returns:

True if the name tag is visible, false otherwise.


function isOnGround

Returns true if the actor is supported by a block.

virtual bool endstone::Actor::isOnGround () const = 0

Returns:

True if actor is on ground.


function isValid

Returns false if the entity has died, been despawned for some other reason, or has not been added to the level.

virtual bool endstone::Actor::isValid () const = 0

Returns:

True if valid.


function remove

Remove this actor from the level.

virtual void endstone::Actor::remove () = 0

If you are trying to remove a Player, use Player::kick() instead.


function removeScoreboardTag

Removes a given tag from this actor.

virtual bool endstone::Actor::removeScoreboardTag (
    std::string tag
) const = 0

Parameters:

  • tag the tag to remove

Returns:

true if the tag was successfully removed, false if the tag does not exist.


function setNameTag

Sets the name tag for the actor.

virtual void endstone::Actor::setNameTag (
    std::string name
) = 0

Parameters:

  • name The new name tag to set.

function setNameTagAlwaysVisible

Sets whether the actor's name tag should always be visible.

virtual void endstone::Actor::setNameTagAlwaysVisible (
    bool visible
) = 0

Parameters:

  • visible True to make the name tag always visible, false to disable always visibility.

function setNameTagVisible

Sets if the actor's name tag is visible or not.

virtual void endstone::Actor::setNameTagVisible (
    bool visible
) = 0

Parameters:

  • visible True to make the name tag visible, false to hide it.

function setRotation

Sets the actor's rotation.

virtual void endstone::Actor::setRotation (
    float yaw,
    float pitch
) = 0

Note that if the actor is affected by AI, it may override this rotation.

Parameters:

  • yaw Rotation around the up axis (Y axis)
  • pitch Rotation around the right axis (X axis)

function setScoreTag

Sets the score tag for the actor.

virtual void endstone::Actor::setScoreTag (
    std::string score
) = 0

Parameters:

  • score The new score tag to set.

function teleport [½]

Teleports this actor to the given location.

virtual bool endstone::Actor::teleport (
    const  Location & location
) = 0

Parameters:

  • location New location to teleport this actor to

Returns:

true if the teleport was successful.


function teleport [2/2]

Teleports this actor to the target Actor .

virtual bool endstone::Actor::teleport (
    const  Actor & target
) = 0

Parameters:

  • target Actor to teleport this actor to

Returns:

true if the teleport was successful.



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