Class endstone::Mob¶
Represents a mobile entity (i.e. More...
#include <endstone/actor/mob.h>
Inherits the following classes: endstone::Actor
Inherited by the following classes: endstone::Player
Public Functions¶
| Type | Name |
|---|---|
| virtual void | addEffect (const Effect & effect) = 0 Adds the given Effect to this entity. |
| virtual std::vector< Effect > | getActiveEffects () const = 0 Returns all currently active Effects on this entity. |
| virtual std::unique_ptr< AttributeInstance > | getAttribute (AttributeId id) = 0 Gets the specified attribute instance from the object. |
| virtual std::vector< std::unique_ptr< AttributeInstance > > | getAttributes () = 0 Gets all attribute instances from the object. |
| virtual std::optional< Effect > | getEffect (EffectId type) const = 0 Returns the active Effect of the specified type. |
| virtual int | getHealth () const = 0 Gets the entity's health from 0 to its max possible value, where 0 is dead. |
| virtual int | getMaxHealth () const = 0 Gets the maximum health this entity has. |
| virtual bool | hasAttribute (AttributeId id) const = 0 Checks whether the given attribute is present on the object. |
| virtual bool | hasEffect (EffectId type) const = 0 Returns whether the entity already has an existing effect of the given type applied to it. |
| virtual bool | isGliding () const = 0 Checks to see if an actor is gliding, such as using an Elytra. |
| virtual void | removeEffect (EffectId type) = 0 Removes any effects of the given type that are present on this entity. |
| virtual void | setHealth (int health) const = 0 Sets the entity's health from 0 to its possible value, where 0 is dead. |
| virtual void | setMaxHealth (int health) const = 0 Sets the maximum health this entity can have. |
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 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¶
| 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¶
| 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 |
Detailed Description¶
living entity), such as a monster or player.
Public Functions Documentation¶
function addEffect¶
Adds the given Effect to this entity.
Only one effect of any given type may be active at any one time. If this entity already has an effect of the same type, it will be overwritten with the new one.
Parameters:
effectEffect to be added
function getActiveEffects¶
Returns all currently active Effects on this entity.
Returns:
a vector of Effects
function getAttribute¶
Gets the specified attribute instance from the object.
This instance will be backed directly to the object and any changes will be visible at once.
Parameters:
idThe attribute to get
function getAttributes¶
Gets all attribute instances from the object.
This instance will be backed directly to the object and any changes will be visible at once.
function getEffect¶
Returns the active Effect of the specified type.
If the effect is not present on the entity then std::nullopt will be returned.
Parameters:
typethe effect type to check
Returns:
the active effect, or std::nullopt if not present
function getHealth¶
Gets the entity's health from 0 to its max possible value, where 0 is dead.
Returns:
Health represented from 0 to max
function getMaxHealth¶
Gets the maximum health this entity has.
Returns:
Maximum health
function hasAttribute¶
Checks whether the given attribute is present on the object.
Parameters:
idThe attribute to check
function hasEffect¶
Returns whether the entity already has an existing effect of the given type applied to it.
Parameters:
typethe effect type to check
Returns:
whether the entity has the given potion effect active
function isGliding¶
Checks to see if an actor is gliding, such as using an Elytra.
Returns:
True if this actor is gliding.
function removeEffect¶
Removes any effects of the given type that are present on this entity.
Parameters:
typethe effect type to remove
function setHealth¶
Sets the entity's health from 0 to its possible value, where 0 is dead.
Parameters:
healthNew health represented from 0 to max
function setMaxHealth¶
Sets the maximum health this entity can have.
If the health of the entity is above the value provided, it will be set to that value.
Note:
An entity with a health bar e.g., Player, EnderDragon, Wither, etc. will have their bar scaled accordingly.
Parameters:
healthamount of health to set the maximum to
The documentation for this class was generated from the following file include/endstone/actor/mob.h