endstone::Actor
Represents a base actor in the level.
Bases: endstone::CommandSender
Functions:
| Name | Description |
|---|---|
addScoreboardTag | Adds a tag to this actor. |
asItem | Gets an Actor as Item . |
asMob | Gets an Actor as Mob . |
getDimension | |
getHealth | Gets the entity’s health from 0 to its max possible value, where 0 is dead. |
getId | Returns a unique id for this actor. |
getLevel | |
getLocation | |
getMaxHealth | Gets the maximum health this entity has. |
getNameTag | Gets the current name tag of the actor. |
getRuntimeId | |
getScoreTag | Gets the current score tag of the actor. |
getScoreboardTags | Returns a list of scoreboard tags for this actor. |
getType | Get the type of the actor. |
getVelocity | |
isDead | Returns true if this actor has been marked for removal. |
isInLava | |
isInWater | |
isNameTagAlwaysVisible | Checks if the actor’s name tag is always visible. |
isNameTagVisible | Checks if the actor’s name tag is currently visible. |
isOnGround | |
isValid | |
remove | |
removeScoreboardTag | Removes a given tag from this actor. |
setHealth | |
setNameTag | Sets the name tag for the actor. |
setNameTagAlwaysVisible | Sets whether the actor’s name tag should always be visible. |
setNameTagVisible | Sets if the actor’s name tag is visible or not. |
setRotation | |
setScoreTag | Sets the score tag for the actor. |
teleport | |
teleport |
addScoreboardTag
bool addScoreboardTag(std::string tag) constAdds a tag to this actor.
Parameters:
tagthe tag to add
Returns:
true if the tag was successfully added, false if the tag already exists.
asItem
Item *asItem() constGets an Actor as Item .
Returns:
asMob
Mob *asMob() constGets an Actor as Mob .
Returns:
getDimension
Dimension &getDimension() constGets the current Dimension this actor resides in
Returns:
The current Dimension this actor resides in
getHealth
int getHealth() constGets the entity’s health from 0 to its max possible value, where 0 is dead.
Returns:
Health represented from 0 to max
getId
std::int64_t getId() constReturns a unique id for this actor.
Returns:
Actor id
getLevel
Level &getLevel() constGets the current Level this actor resides in
Returns:
The current Level this actor resides in
getLocation
Location getLocation() constGets the actor’s current position
Returns:
a new copy of Location containing the position of this actor
getMaxHealth
int getMaxHealth() constGets the maximum health this entity has.
Returns:
Maximum health
getNameTag
std::string getNameTag() constGets the current name tag of the actor.
Returns:
The name tag.
getRuntimeId
std::uint64_t getRuntimeId() constReturns the runtime id for this actor
Returns:
Runtime id for this actor
getScoreTag
std::string getScoreTag() constGets the current score tag of the actor.
Returns:
The score tag.
getScoreboardTags
std::vector<std::string> getScoreboardTags() constReturns a list of scoreboard tags for this actor.
Returns:
a list of scoreboard tags for this actor
getType
std::string getType() constGet the type of the actor.
This method returns the type of the actor as a string, for example, minecraft:pig.
Returns:
The type of the actor.
getVelocity
Vector<float> getVelocity() constGets this actor’s current velocity
Returns:
Current traveling velocity of this actor
isDead
bool isDead() constReturns true if this actor has been marked for removal.
Returns:
True if it is dead.
isInLava
bool isInLava() constReturns true if the actor is in lava.
Returns:
True if the actor is in lava.
isInWater
bool isInWater() constReturns true if the actor is in water.
Returns:
True if the actor is in water.
isNameTagAlwaysVisible
bool isNameTagAlwaysVisible() constChecks if the actor’s name tag is always visible.
Returns:
True if the name tag is always visible, false otherwise.
isNameTagVisible
bool isNameTagVisible() constChecks if the actor’s name tag is currently visible.
Returns:
True if the name tag is visible, false otherwise.
isOnGround
bool isOnGround() constReturns true if the actor is supported by a block.
Returns:
True if actor is on ground.
isValid
bool isValid() constReturns false if the entity has died, been despawned for some other reason, or has not been added to the level.
Returns:
True if valid.
remove
void remove()Remove this actor from the level.
If you are trying to remove a Player, use Player::kick instead.
removeScoreboardTag
bool removeScoreboardTag(std::string tag) constRemoves a given tag from this actor.
Parameters:
tagthe tag to remove
Returns:
true if the tag was successfully removed, false if the tag does not exist.
setHealth
Result<void> setHealth(int health) constSets the entity’s health from 0 to its possible value, where 0 is dead.
Parameters:
healthNew health represented from 0 to max
setNameTag
void setNameTag(std::string name)Sets the name tag for the actor.
Parameters:
nameThe new name tag to set.
setNameTagAlwaysVisible
void setNameTagAlwaysVisible(bool visible)Sets whether the actor’s name tag should always be visible.
Parameters:
visibleTrue to make the name tag always visible, false to disable always visibility.
setNameTagVisible
void setNameTagVisible(bool visible)Sets if the actor’s name tag is visible or not.
Parameters:
visibleTrue to make the name tag visible, false to hide it.
setRotation
void setRotation(float yaw, float pitch)Returns:
Sets the actor’s rotation.
Note that if the actor is affected by AI, it may override this rotation.
Parameters:
yawRotation around the up axis (Y axis)pitchRotation around the right axis (X axis)
setScoreTag
void setScoreTag(std::string score)Sets the score tag for the actor.
Parameters:
scoreThe new score tag to set.
teleport
void teleport(Location location)Returns:
Teleports this actor to the given location.
Parameters:
locationNew location to teleport this actor to
void teleport(Actor &target)Teleports this actor to the target Actor.
Parameters:
targetActor to teleport this actor to