endstone::ActorKnockbackEvent
Called when a living entity receives knockback.
Bases: endstone::Cancellable< ActorEvent< Mob > >
Attributes:
| Name | Description |
|---|---|
NAME |
Functions:
| Name | Description |
|---|---|
ActorKnockbackEvent | |
getEventName | |
getKnockback | |
getSource | Get the source actor that has caused knockback to the defender, if exists. |
setKnockback | Sets 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 constGets a user-friendly identifier for this event.
Returns:
name of this event
getKnockback
Vector<float> getKnockback() constGets 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() constGet 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:
knockbackthe knockback to apply
Last updated on