|
26 | 26 | #include <mc/world/actor/ArmorStand.h> |
27 | 27 | #include <mc/world/actor/FishingHook.h> |
28 | 28 | #include <mc/world/actor/Hopper.h> |
| 29 | +#include <mc/world/actor/VanillaActorRendererId.h> |
29 | 30 | #include <mc/world/actor/boss/WitherBoss.h> |
30 | 31 | #include <mc/world/actor/item/ItemActor.h> |
31 | 32 | #include <mc/world/actor/player/Player.h> |
|
35 | 36 | #include <mc/world/item/BucketItem.h> |
36 | 37 | #include <mc/world/item/CrossbowItem.h> |
37 | 38 | #include <mc/world/item/ItemInstance.h> |
| 39 | +#include <mc/world/item/TridentItem.h> |
38 | 40 | #include <mc/world/item/registry/ItemStack.h> |
39 | 41 | #include <mc/world/level/BlockEventCoordinator.h> |
40 | 42 | #include <mc/world/level/BlockSource.h> |
|
59 | 61 | #include <mc/world/phys/AABB.h> |
60 | 62 | #include <mc/world/scores/ServerScoreboard.h> |
61 | 63 |
|
| 64 | + |
62 | 65 | namespace lse::events { |
63 | 66 |
|
64 | 67 | // NOLINTBEGIN(modernize-use-trailing-return-type) |
@@ -358,12 +361,14 @@ LL_TYPE_INSTANCE_HOOK( |
358 | 361 | Vec3 const& direction |
359 | 362 | ) { |
360 | 363 | IF_LISTENED(EVENT_TYPES::onSpawnProjectile) { |
361 | | - CallEventRtnValue( |
362 | | - EVENT_TYPES::onSpawnProjectile, |
363 | | - nullptr, |
364 | | - EntityClass::newEntity(spawner), |
365 | | - String::newString(id.getCanonicalName()) |
366 | | - ); |
| 364 | + if (id._getLegacyActorType() != ActorType::Trident) { |
| 365 | + CallEventRtnValue( |
| 366 | + EVENT_TYPES::onSpawnProjectile, |
| 367 | + nullptr, |
| 368 | + EntityClass::newEntity(spawner), |
| 369 | + String::newString(id.getCanonicalName()) |
| 370 | + ); |
| 371 | + } |
367 | 372 | } |
368 | 373 | IF_LISTENED_END(EVENT_TYPES::onSpawnProjectile); |
369 | 374 | Actor* projectile = origin(region, id, spawner, position, direction); |
@@ -398,6 +403,27 @@ LL_TYPE_INSTANCE_HOOK( |
398 | 403 | origin(projectileInstance, player); |
399 | 404 | } |
400 | 405 |
|
| 406 | +LL_TYPE_INSTANCE_HOOK( |
| 407 | + ProjectileSpawnHook3, |
| 408 | + HookPriority::Normal, |
| 409 | + TridentItem, |
| 410 | + "?releaseUsing@TridentItem@@UEBAXAEAVItemStack@@PEAVPlayer@@H@Z", |
| 411 | + void, |
| 412 | + ItemStack& item, |
| 413 | + Player* player, |
| 414 | + int durationLeft |
| 415 | +) { |
| 416 | + IF_LISTENED(EVENT_TYPES::onSpawnProjectile) { |
| 417 | + CallEventVoid( |
| 418 | + EVENT_TYPES::onSpawnProjectile, |
| 419 | + EntityClass::newEntity(player), |
| 420 | + String::newString(VanillaActorRendererId::trident.getString()) |
| 421 | + ); |
| 422 | + } |
| 423 | + IF_LISTENED_END(EVENT_TYPES::onSpawnProjectile); |
| 424 | + origin(item, player, durationLeft); |
| 425 | +} |
| 426 | + |
401 | 427 | LL_TYPE_INSTANCE_HOOK( |
402 | 428 | PressurePlateTriggerHook, |
403 | 429 | HookPriority::Normal, |
@@ -1141,7 +1167,8 @@ void PlayerUseFrameEvent() { |
1141 | 1167 | } |
1142 | 1168 | void ProjectileSpawnEvent() { |
1143 | 1169 | ProjectileSpawnHook1::hook(); |
1144 | | - ProjectileSpawnHook2 ::hook(); |
| 1170 | + ProjectileSpawnHook2::hook(); |
| 1171 | + ProjectileSpawnHook3::hook(); |
1145 | 1172 | }; |
1146 | 1173 | void ProjectileCreatedEvent() { ProjectileSpawnHook1::hook(); }; |
1147 | 1174 | void PressurePlateTriggerEvent() { PressurePlateTriggerHook::hook(); } |
|
0 commit comments