mirror of
https://github.com/quizhizhe/LiteLoaderBDS-1.16.40.git
synced 2025-07-25 21:20:36 +00:00
修复PlayerDropItem
事件
This commit is contained in:
parent
62950cbd21
commit
a73afd9fe9
@ -79,6 +79,8 @@ namespace ll{
|
|||||||
constexpr uint64_t EVENTAPI_PlayerInteractEntity_2 = 0x70;
|
constexpr uint64_t EVENTAPI_PlayerInteractEntity_2 = 0x70;
|
||||||
// Hopper::Hopper
|
// Hopper::Hopper
|
||||||
constexpr uint64_t EVENTAPI_HopperSearchItem = 0x5;
|
constexpr uint64_t EVENTAPI_HopperSearchItem = 0x5;
|
||||||
|
// FillingContainer::FillingContainer a2
|
||||||
|
constexpr uint64_t EVENTAPI_PlayerDropItem = 0xF8;
|
||||||
|
|
||||||
// ->src/llapi/mc
|
// ->src/llapi/mc
|
||||||
|
|
||||||
|
@ -1825,28 +1825,29 @@ TInstanceHook(void*, "?handle@ComplexInventoryTransaction@@UEBA?AW4InventoryTran
|
|||||||
return original(this, player, isSenderAuthority);
|
return original(this, player, isSenderAuthority);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 没有这个符号
|
// 更换符号,逻辑大概一致,未清楚玩家丢物品是否调用
|
||||||
// TInstanceHook(void, "?dropSlot@Inventory@@QEAAXH_N00@Z",
|
#include <llapi/mc/FillingContainer.hpp>
|
||||||
// Container, int a2, char a3, char a4, bool a5) {
|
TInstanceHook(void, "?dropSlot@FillingContainer@@QEAAXH_N00@Z",
|
||||||
// auto pl = dAccess<Player*, 248>(this);
|
FillingContainer, signed int slot, char unk) {
|
||||||
// if (pl->isPlayer()) {
|
auto player = dAccess<Player*, ll::offset::EVENTAPI_PlayerDropItem>(this);
|
||||||
// IF_LISTENED(PlayerDropItemEvent) {
|
if (player->isPlayer()) {
|
||||||
// PlayerDropItemEvent ev{};
|
IF_LISTENED(PlayerDropItemEvent) {
|
||||||
// if (a2 >= 0) {
|
PlayerDropItemEvent ev{};
|
||||||
// auto& item = this->getItem(a2);
|
if (slot >= 0) {
|
||||||
// if (!item.isNull()) {
|
auto& item = this->getItem(slot);
|
||||||
// ev.mItemStack = const_cast<ItemStack*>(&item);
|
if (!item.isNull()) {
|
||||||
// ev.mPlayer = pl;
|
ev.mItemStack = const_cast<ItemStack*>(&item);
|
||||||
// }
|
ev.mPlayer = player;
|
||||||
// if (!ev.call()) {
|
}
|
||||||
// return;
|
if (!ev.call()) {
|
||||||
// }
|
return;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// IF_LISTENED_END(PlayerDropItemEvent)
|
}
|
||||||
// }
|
IF_LISTENED_END(PlayerDropItemEvent)
|
||||||
// return original(this, a2, a3, a4, a5);
|
}
|
||||||
// }
|
return original(this, slot, unk);
|
||||||
|
}
|
||||||
|
|
||||||
////////////// PlayerBedEnter //////////////
|
////////////// PlayerBedEnter //////////////
|
||||||
TInstanceHook(int, "?startSleepInBed@Player@@UEAA?AW4BedSleepingResult@@AEBVBlockPos@@@Z",
|
TInstanceHook(int, "?startSleepInBed@Player@@UEAA?AW4BedSleepingResult@@AEBVBlockPos@@@Z",
|
||||||
|
Loading…
Reference in New Issue
Block a user