diff --git a/include/endstone/event/actor/actor_knockback_event.h b/include/endstone/event/actor/actor_knockback_event.h index 24f6c31d3..618ccbec8 100644 --- a/include/endstone/event/actor/actor_knockback_event.h +++ b/include/endstone/event/actor/actor_knockback_event.h @@ -14,8 +14,8 @@ #pragma once -#include "endstone/event/actor/actor_event.h" #include "endstone/actor/mob.h" +#include "endstone/event/actor/actor_event.h" namespace endstone { @@ -24,8 +24,8 @@ namespace endstone { */ class ActorKnockbackEvent : public ActorEvent { public: - explicit ActorKnockbackEvent(Mob &mob, Actor *source, Vector raw_knockback, Vector knockback) - : ActorEvent(mob), mob_(mob), source_(source), raw_knockback_(raw_knockback), knockback_(knockback) + explicit ActorKnockbackEvent(Mob &mob, Actor *source, Vector knockback) + : ActorEvent(mob), mob_(mob), source_(source), knockback_(knockback) { } ~ActorKnockbackEvent() override = default; @@ -61,19 +61,6 @@ class ActorKnockbackEvent : public ActorEvent { return source_; } - /** - * @brief Gets the raw knockback that will be applied to the entity. - * - *

- * This value is read-only, changes made to it will not have any effect on the final knockback received. - * - * @return the raw knockback - */ - [[nodiscard]] Vector getRawKnockback() const - { - return raw_knockback_; - } - /** * Gets the knockback that will be applied to the entity. * diff --git a/python/src/endstone/_internal/endstone_python.pyi b/python/src/endstone/_internal/endstone_python.pyi index 73d2d7622..41982af7b 100644 --- a/python/src/endstone/_internal/endstone_python.pyi +++ b/python/src/endstone/_internal/endstone_python.pyi @@ -184,11 +184,6 @@ class ActorKnockbackEvent(ActorEvent): def knockback(self, arg1: Vector) -> None: ... @property - def raw_knockback(self) -> Vector: - """ - Gets the raw knockback that will be applied to the entity. - """ - @property def source(self) -> Actor: """ Get the source actor that has caused knockback to the defender, if exists. diff --git a/src/endstone_python/event.cpp b/src/endstone_python/event.cpp index 07a17d1a8..886d86246 100644 --- a/src/endstone_python/event.cpp +++ b/src/endstone_python/event.cpp @@ -84,8 +84,6 @@ void init_event(py::module_ &m, py::class_ &event, py::enum_(m, "ActorRemoveEvent", "Called when an Actor is removed."); diff --git a/src/endstone_runtime/bedrock/world/actor/mob.cpp b/src/endstone_runtime/bedrock/world/actor/mob.cpp index 61234e2a2..1eab95475 100644 --- a/src/endstone_runtime/bedrock/world/actor/mob.cpp +++ b/src/endstone_runtime/bedrock/world/actor/mob.cpp @@ -44,14 +44,12 @@ void Mob::knockback(Actor *source, int damage, float dx, float dz, float horizon auto diff = after - before; auto &server = entt::locator::value(); - endstone::ActorKnockbackEvent e{getEndstoneMob(), - source == nullptr ? nullptr : &source->getEndstoneActor(), - {diff.x, diff.y, diff.z}, - {after.x, after.y, after.z}}; + endstone::ActorKnockbackEvent e{ + getEndstoneMob(), source == nullptr ? nullptr : &source->getEndstoneActor(), {diff.x, diff.y, diff.z}}; server.getPluginManager().callEvent(e); auto knockback = e.getKnockback(); - diff = e.isCancelled() ? Vec3::ZERO : (Vec3{knockback.getX(), knockback.getY(), knockback.getZ()} - before); + diff = e.isCancelled() ? Vec3::ZERO : Vec3{knockback.getX(), knockback.getY(), knockback.getZ()}; setPosDelta(before + diff); }