|
20 | 20 | #include "mc/world/actor/player/Player.h" |
21 | 21 | #include "mc/world/actor/player/PlayerInventory.h" |
22 | 22 | #include "mc/world/actor/player/PlayerItemInUse.h" |
23 | | -#include "mc/world/containers/models/LevelContainerModel.h" |
24 | 23 | #include "mc/world/effect/EffectDuration.h" |
25 | 24 | #include "mc/world/effect/MobEffectInstance.h" |
26 | 25 | #include "mc/world/events/BlockEventCoordinator.h" |
27 | 26 | #include "mc/world/events/EventResult.h" |
28 | 27 | #include "mc/world/events/PlayerOpenContainerEvent.h" |
29 | 28 | #include "mc/world/gamemode/InteractionResult.h" |
| 29 | +#include "mc/world/inventory/network/ItemStackNetManagerBase.h" |
30 | 30 | #include "mc/world/inventory/transaction/ComplexInventoryTransaction.h" |
31 | 31 | #include "mc/world/inventory/transaction/InventoryAction.h" |
32 | 32 | #include "mc/world/inventory/transaction/InventorySource.h" |
@@ -357,14 +357,21 @@ LL_TYPE_INSTANCE_HOOK( |
357 | 357 | origin(player, std::move(changeRequest)); |
358 | 358 | } |
359 | 359 |
|
360 | | -LL_TYPE_INSTANCE_HOOK(OpenContainerScreenHook, HookPriority::Normal, Player, &Player::canOpenContainerScreen, bool) { |
| 360 | +LL_TYPE_INSTANCE_HOOK( |
| 361 | + OpenContainerScreenHook, |
| 362 | + HookPriority::Normal, |
| 363 | + ItemStackNetManagerBase, |
| 364 | + &ItemStackNetManagerBase::$onContainerScreenOpen, |
| 365 | + void, |
| 366 | + ContainerScreenContext const& screenContext |
| 367 | +) { |
361 | 368 | IF_LISTENED(EVENT_TYPES::onOpenContainerScreen) { |
362 | | - if (!CallEvent(EVENT_TYPES::onOpenContainerScreen, PlayerClass::newPlayer(this))) { |
363 | | - return false; |
| 369 | + if (!CallEvent(EVENT_TYPES::onOpenContainerScreen, PlayerClass::newPlayer(&mUnkecd0f2.as<Player&>()))) { |
| 370 | + return; |
364 | 371 | } |
365 | 372 | } |
366 | 373 | IF_LISTENED_END(EVENT_TYPES::onOpenContainerScreen); |
367 | | - return origin(); |
| 374 | + return origin(screenContext); |
368 | 375 | } |
369 | 376 |
|
370 | 377 | LL_TYPE_STATIC_HOOK( |
|
0 commit comments