From 4097c5417f4d13459d2bf997b26aba9cd1614773 Mon Sep 17 00:00:00 2001 From: Qiuzhizhe <42761326+quizhizhe@users.noreply.github.com> Date: Sat, 18 Mar 2023 06:40:27 -0700 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D`ProjectileHitEntity`?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LiteLoader/src/llapi/EventAPI.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/LiteLoader/src/llapi/EventAPI.cpp b/LiteLoader/src/llapi/EventAPI.cpp index 047479f..35a3b28 100644 --- a/LiteLoader/src/llapi/EventAPI.cpp +++ b/LiteLoader/src/llapi/EventAPI.cpp @@ -1537,20 +1537,20 @@ TInstanceHook(void, "?explode@Explosion@@QEAAXXZ",Explosion) { ////////////// ProjectileHitEntity ////////////// -// TClasslessInstanceHook(void, "?onHit@ProjectileComponent@@QEAAXAEAVActor@@AEBVHitResult@@@Z", -// Actor* item, HitResult* res) { -// IF_LISTENED(ProjectileHitEntityEvent) { -// Actor* to = res->getEntity(); -// if (to) { -// ProjectileHitEntityEvent ev{}; -// ev.mTarget = to; -// ev.mSource = item; -// ev.call(); -// } -// } -// IF_LISTENED_END(ProjectileHitEntityEvent) -// return original(this, item, res); -// } + TClasslessInstanceHook(void, "?onHit@ProjectileComponent@@QEAAXAEAVActor@@AEBVHitResult@@@Z", + Actor* item, HitResult* res) { + IF_LISTENED(ProjectileHitEntityEvent) { + Actor* to = res->getEntity(); + if (to) { + ProjectileHitEntityEvent ev{}; + ev.mTarget = to; + ev.mSource = item; + ev.call(); + } + } + IF_LISTENED_END(ProjectileHitEntityEvent) + return original(this, item, res); + } ////////////// WitherBossDestroy //////////////