Skip to Content
⚠ Under Construction
ReferenceC++ APIActorKnockbackEvent

endstone::ActorKnockbackEvent

Called when a living entity receives knockback.

Bases: endstone::Cancellable< ActorEvent< Mob > >

Attributes:

NameDescription
NAME

Functions:

NameDescription
ActorKnockbackEvent
getEventName
getKnockback
getSourceGet the source actor that has caused knockback to the defender, if exists.
setKnockbackSets the knockback that will be applied to the entity.

NAME

const std::string endstone::ActorKnockbackEvent::NAME;

ActorKnockbackEvent

ActorKnockbackEvent(Mob &mob, Actor *source, Vector<float> knockback)

getEventName

std::string getEventName() override const

Gets a user-friendly identifier for this event.

Returns:

name of this event

getKnockback

Vector<float> getKnockback() const

Gets the knockback that will be applied to the entity.

Note: this method returns a copy, changes must be applied with setKnockback(Vector)

Returns:

the knockback

getSource

Actor *getSource() const

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

Returns:

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

setKnockback

void setKnockback(Vector<float> knockback)

Sets the knockback that will be applied to the entity.

Parameters:

  • knockback the knockback to apply
Last updated on