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::Mob

Public Functions

Type Name
virtual bool addScoreboardTag (std::string tag) const = 0
Adds a tag to this actor.
virtual Actor * asActor () override const
Gets a CommandSender asActor .
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::uint64_t getRuntimeId () const = 0
virtual std::vector< std::string > getScoreboardTags () const = 0
Returns a list of scoreboard tags for this 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 isOnGround () const = 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 setRotation (float yaw, float pitch) = 0
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 Result< PermissionAttachment * > addAttachment (Plugin & plugin, const std::string & name, bool value) = 0
virtual Result< PermissionAttachment * > addAttachment (Plugin & plugin) = 0
virtual CommandSender * asCommandSender () const = 0
Casts a Permissible asCommandSender .
virtual std::unordered_set< PermissionAttachmentInfo * > getEffectivePermissions () const = 0
virtual bool hasPermission (std::string name) const = 0
virtual bool hasPermission (const Permission & perm) const = 0
virtual bool isOp () const = 0
Checks if this object is a server operator.
virtual bool isPermissionSet (std::string name) const = 0
virtual bool isPermissionSet (const Permission & perm) const = 0
virtual void recalculatePermissions () = 0
virtual Result< void > removeAttachment (PermissionAttachment & attachment) = 0
virtual void setOp (bool value) = 0
Sets the operator status of this object.
virtual ~Permissible () = 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 asActor

Gets a CommandSender asActor .

inline virtual Actor * endstone::Actor::asActor () override const

Returns:

Player, nullptr if not an Actor

Implements endstone::CommandSender::asActor


function getDimension

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

Gets the current Dimension this actor resides in

Returns:

The current Dimension this actor resides in


function getHealth

Gets the entity's health from 0 to its max possible value, where 0 is dead.

virtual int endstone::Actor::getHealth () const = 0

Returns:

Health represented from 0 to max


function getId

Returns a unique id for this actor.

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

Returns:

Actor id


function getLevel

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

Gets the current Level this actor resides in

Returns:

The current Level this actor resides in


function getLocation

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

Gets the actor's current position

Returns:

a new copy of Location containing the position of this actor


function getMaxHealth

Gets the maximum health this entity has.

virtual int endstone::Actor::getMaxHealth () const = 0

Returns:

Maximum health


function getRuntimeId

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

Returns the runtime id for this actor

Returns:

Runtime id for this actor


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 getVelocity

virtual Vector < float > endstone::Actor::getVelocity () const = 0

Gets this actor's current velocity

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

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

Returns true if the actor is in lava.

Returns:

True if the actor is in lava.


function isInWater

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

Returns true if the actor is in water.

Returns:

True if the actor is in water.


function isOnGround

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

Returns true if the actor is supported by a block.

Returns:

True if actor is on ground.


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 setHealth

virtual Result< void > endstone::Actor::setHealth (
    int health
) const = 0

Sets the entity's health from 0 to its possible value, where 0 is dead.

Parameters:

  • health New health represented from 0 to max

function setRotation

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

Returns:

Sets the actor's rotation.

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 teleport [½]

virtual void endstone::Actor::teleport (
    Location location
) = 0

Returns:

Teleports this actor to the given location.

Parameters:

  • location New location to teleport this actor to

function teleport [2/2]

virtual void endstone::Actor::teleport (
    Actor & target
) = 0

Teleports this actor to the target Actor.

Parameters:

  • target Actor to teleport this actor to


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