|
17 | 17 | #include <mc/server/module/VanillaServerGameplayEventListener.h> |
18 | 18 | #include <mc/world/actor/ActorDefinitionIdentifier.h> |
19 | 19 | #include <mc/world/actor/ArmorStand.h> |
| 20 | +#include <mc/world/actor/FishingHook.h> |
20 | 21 | #include <mc/world/actor/boss/WitherBoss.h> |
| 22 | +#include <mc/world/actor/item/ItemActor.h> |
21 | 23 | #include <mc/world/actor/player/Player.h> |
22 | 24 | #include <mc/world/containers/models/LevelContainerModel.h> |
23 | 25 | #include <mc/world/events/EventResult.h> |
@@ -773,6 +775,28 @@ LL_TYPE_INSTANCE_HOOK( |
773 | 775 | origin(); |
774 | 776 | } |
775 | 777 |
|
| 778 | +LL_TYPE_INSTANCE_HOOK( |
| 779 | + PlayerPullFishingHook, |
| 780 | + HookPriority::Normal, |
| 781 | + FishingHook, |
| 782 | + &FishingHook::_pullCloser, |
| 783 | + void, |
| 784 | + Actor& inEntity, |
| 785 | + float inSpeed |
| 786 | +) { |
| 787 | + IF_LISTENED(EVENT_TYPES::onPlayerPullFishingHook) { |
| 788 | + CallEventVoid( |
| 789 | + EVENT_TYPES::onPlayerPullFishingHook, |
| 790 | + PlayerClass::newPlayer(this->getPlayerOwner()), |
| 791 | + EntityClass::newEntity(&inEntity), |
| 792 | + inEntity.isType(ActorType::ItemEntity) ? ItemClass::newItem(&static_cast<ItemActor&>(inEntity).item(), true) |
| 793 | + : Local<Value>() |
| 794 | + ); |
| 795 | + } |
| 796 | + IF_LISTENED_END(EVENT_TYPES::onPlayerPullFishingHook); |
| 797 | + origin(inEntity, inSpeed); |
| 798 | +} |
| 799 | + |
776 | 800 | void PlayerStartDestroyBlock() { PlayerStartDestroyHook::hook(); } |
777 | 801 | void PlayerDropItem() { PlayerDropItemHook::hook(); } |
778 | 802 | void PlayerOpenContainerEvent() { PlayerOpenContainerHook::hook(); } |
@@ -815,6 +839,7 @@ void CommandBlockExecuteEvent() { CommandBlockExecuteHook::hook(); } |
815 | 839 | void PlayerUseRespawnAnchorEvent() { PlayerUseRespawnAnchorHook::hook(); } |
816 | 840 | void PlayerSleepEvent() { PlayerSleepHook::hook(); } |
817 | 841 | void PlayerOpenInventoryEvent() { PlayerOpenInventoryHook::hook(); } |
| 842 | +void PlayerPullFishingHookEvent() { PlayerPullFishingHook::hook(); } |
818 | 843 |
|
819 | 844 | // NOLINTEND(cppcoreguidelines-pro-type-reinterpret-cast) |
820 | 845 | // NOLINTEND(cppcoreguidelines-avoid-non-const-global-variables) |
|
0 commit comments