Skip to content

Class endstone::ActorKnockbackEvent

ClassList > endstone > ActorKnockbackEvent

Called when a living entity receives knockback.

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

Inherits the following classes: endstone::Cancellable

Public Functions

Type Name
ActorKnockbackEvent (Mob & mob, Actor * source, Vector knockback)
ENDSTONE_EVENT (ActorKnockbackEvent)
Vector getKnockback () const
Gets the knockback that will be applied to the entity.
Actor * getSource () const
Get the source actor that has caused knockback to the defender, if exists.
void setKnockback (Vector knockback)
Sets the knockback that will be applied to the entity.

Public Functions inherited from endstone::Cancellable

See endstone::Cancellable

Type Name
virtual void cancel ()
Cancel this event.
virtual bool isCancelled () override const
Gets the cancellation state of this event.
virtual void setCancelled (bool cancel) override
Sets the cancellation state of this event.

Public Functions inherited from endstone::ICancellable

See endstone::ICancellable

Type Name
virtual void cancel () = 0
Cancels this event.
virtual bool isCancelled () const = 0
Gets the cancellation state of this event.
virtual void setCancelled (bool cancel) = 0
Sets the cancellation state of this event.
virtual ~ICancellable () = default

Public Functions Documentation

function ActorKnockbackEvent

inline explicit endstone::ActorKnockbackEvent::ActorKnockbackEvent (
    Mob & mob,
    Actor * source,
    Vector knockback
) 

function ENDSTONE_EVENT

endstone::ActorKnockbackEvent::ENDSTONE_EVENT (
    ActorKnockbackEvent
) 

function getKnockback

Gets the knockback that will be applied to the entity.

inline Vector endstone::ActorKnockbackEvent::getKnockback () const

Note: this method returns a copy; changes must be applied via setKnockback().

Returns:

the knockback


function getSource

Get the source actor that has caused knockback to the defender, if exists.

inline Actor * endstone::ActorKnockbackEvent::getSource () const

Returns:

actor that caused knockback, or nullptr if the knockback is not caused by an actor.


function setKnockback

Sets the knockback that will be applied to the entity.

inline void endstone::ActorKnockbackEvent::setKnockback (
    Vector knockback
) 

Parameters:

  • knockback the knockback to apply


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