修复部分没有符合的EventAPI

This commit is contained in:
Qiuzhizhe 2022-10-02 01:14:35 -07:00
parent 4bbb416d6a
commit 5710878d29
2 changed files with 202 additions and 200 deletions

View File

@ -16,6 +16,11 @@ std::string identifier; // 32
std::string event; // 64 std::string event; // 64
std::string fullname; // 96 std::string fullname; // 96
HashedString canonicalHash; // 128 HashedString canonicalHash; // 128
public:
inline const std::string getCanonicalName(){
return this->canonicalHash.getString();
}
#undef AFTER_EXTRA #undef AFTER_EXTRA
#ifndef DISABLE_CONSTRUCTOR_PREVENTION_ACTORDEFINITIONIDENTIFIER #ifndef DISABLE_CONSTRUCTOR_PREVENTION_ACTORDEFINITIONIDENTIFIER
public: public:

View File

@ -321,7 +321,6 @@ TClasslessInstanceHook(void, "?sendLoginMessageLocal@ServerNetworkHandler@@QEAAX
/////////////////// PlayerJoin /////////////////// /////////////////// PlayerJoin ///////////////////
//没有这个符号
TInstanceHook(bool, "?onReady_ClientGeneration@ServerNetworkHandler@@QEAAXAEAVPlayer@@AEBVNetworkIdentifier@@@Z", TInstanceHook(bool, "?onReady_ClientGeneration@ServerNetworkHandler@@QEAAXAEAVPlayer@@AEBVNetworkIdentifier@@@Z",
ServerNetworkHandler,Player* player,NetworkIdentifier *net) { ServerNetworkHandler,Player* player,NetworkIdentifier *net) {
IF_LISTENED(PlayerJoinEvent) { IF_LISTENED(PlayerJoinEvent) {
@ -397,23 +396,23 @@ public:
std::unique_ptr<CompoundTag> mAgentTag; std::unique_ptr<CompoundTag> mAgentTag;
}; };
//没有这个符号 // 更换符号
// TClasslessInstanceHook(bool, "?requestPlayerChangeDimension@Level@@UEAAXAEAVPlayer@@V?$unique_ptr@VChangeDimensionRequest@@U?$default_delete@VChangeDimensionRequest@@@std@@@std@@@Z", TClasslessInstanceHook(bool, "?requestPlayerChangeDimension@Level@@QEAAXAEAVPlayer@@V?$unique_ptr@VChangeDimensionRequest@@U?$default_delete@VChangeDimensionRequest@@@std@@@std@@@Z",
// Player* sp, std::unique_ptr<ChangeDimensionRequest> request) { Player* sp, std::unique_ptr<ChangeDimensionRequest> request) {
// if (request->mToDimensionId == sp->getDimensionId()) if (request->mToDimensionId == sp->getDimensionId())
// return original(this, sp, std::move(request)); return original(this, sp, std::move(request));
// IF_LISTENED(PlayerChangeDimEvent) { IF_LISTENED(PlayerChangeDimEvent) {
// PlayerChangeDimEvent ev{}; PlayerChangeDimEvent ev{};
// ev.mPlayer = sp; ev.mPlayer = sp;
// ev.mToDimensionId = request->mToDimensionId; ev.mToDimensionId = request->mToDimensionId;
// if (!ev.call()) if (!ev.call())
// return false; return false;
// } }
// IF_LISTENED_END(PlayerChangeDimEvent) IF_LISTENED_END(PlayerChangeDimEvent)
// return original(this, sp, std::move(request)); return original(this, sp, std::move(request));
// } }
int num = 0; int num = 0;
/////////////////// PlayerJump /////////////////// /////////////////// PlayerJump ///////////////////
@ -428,40 +427,39 @@ TInstanceHook(void, "?jumpFromGround@Player@@UEAAXXZ", Player) {
} }
/////////////////// PlayerSneak /////////////////// /////////////////// PlayerSneak ///////////////////
//没有这个符号 //不清楚这个符合能不能正常触发
// TClasslessInstanceHook(void, "?sendActorSneakChanged@ActorEventCoordinator@@QEAAXAEAVActor@@_N@Z", TClasslessInstanceHook(void, "?onActorSneakChanged@ScriptServerActorEventListener@@UEAA?AW4EventResult@@AEAVActor@@_N@Z",
// Actor* ac, bool isSneaking) { Actor* ac, bool isSneaking) {
// IF_LISTENED(PlayerSneakEvent) { IF_LISTENED(PlayerSneakEvent) {
// PlayerSneakEvent ev{}; PlayerSneakEvent ev{};
// ev.mPlayer = (Player*)ac; ev.mPlayer = (Player*)ac;
// ev.mIsSneaking = isSneaking; ev.mIsSneaking = isSneaking;
// ev.call(); ev.call();
// isSneaking = ev.mIsSneaking; isSneaking = ev.mIsSneaking;
// } }
// IF_LISTENED_END(PlayerSneakEvent) IF_LISTENED_END(PlayerSneakEvent)
// return original(this, ac, isSneaking); return original(this, ac, isSneaking);
// } }
/////////////////// PlayerAttackEntity /////////////////// /////////////////// PlayerAttackEntity ///////////////////
//没有这个符号 //同名函数没有了伤害原因参数
// TInstanceHook(bool, "?attack@Player@@UEAA_NAEAVActor@@AEBW4ActorDamageCause@@@Z", TInstanceHook(bool, "?attack@Player@@UEAA_NAEAVActor@@@Z",
// Player, Actor* ac, int* damageCause) { Player, Actor* ac) {
// IF_LISTENED(PlayerAttackEvent) { IF_LISTENED(PlayerAttackEvent) {
// PlayerAttackEvent ev{}; PlayerAttackEvent ev{};
// ev.mPlayer = this; ev.mPlayer = this;
// ev.mTarget = ac; ev.mTarget = ac;
// ev.mAttackDamage = *damageCause; ev.mAttackDamage = this->calculateAttackDamage(*ac);
// if (!ev.call()) if (!ev.call())
// return false; return false;
// ac = ev.mTarget; ac = ev.mTarget;
// *damageCause = ev.mAttackDamage; }
// } IF_LISTENED_END(PlayerAttackEvent)
// IF_LISTENED_END(PlayerAttackEvent) return original(this, ac);
// return original(this, ac, damageCause); }
// }
/////////////////// PlayerAttackBlock /////////////////// /////////////////// PlayerAttackBlock ///////////////////
//没有这个符号 //没有这个符号
@ -557,18 +555,18 @@ TInstanceHook(void, "?onEffectRemoved@ServerPlayer@@MEAAXAEAVMobEffectInstance@@
return original(this, effect); return original(this, effect);
} }
// update // update
// 没有这个符号 // 更换符号
// TInstanceHook(void, "?onEffectUpdated@ServerPlayer@@MEAAXAEAVMobEffectInstance@@@Z", Player, MobEffectInstance* effect) { TInstanceHook(void, "?onEffectUpdated@ServerPlayer@@MEAAXAEBVMobEffectInstance@@@Z", Player, MobEffectInstance* effect) {
// IF_LISTENED(PlayerEffectChangedEvent) { IF_LISTENED(PlayerEffectChangedEvent) {
// PlayerEffectChangedEvent ev{}; PlayerEffectChangedEvent ev{};
// ev.mPlayer = this; ev.mPlayer = this;
// ev.mEventType = PlayerEffectChangedEvent::EventType::Update; ev.mEventType = PlayerEffectChangedEvent::EventType::Update;
// ev.mEffect = effect; ev.mEffect = effect;
// ev.call(); ev.call();
// } }
// IF_LISTENED_END(PlayerEffectChangedEvent) IF_LISTENED_END(PlayerEffectChangedEvent)
// return original(this, effect); return original(this, effect);
// } }
/////////////////// PlayerStartDestroyBlock /////////////////// /////////////////// PlayerStartDestroyBlock ///////////////////
@ -587,24 +585,24 @@ TInstanceHook(void, "?onEffectRemoved@ServerPlayer@@MEAAXAEAVMobEffectInstance@@
/////////////////// PlayerPlaceBlock /////////////////// /////////////////// PlayerPlaceBlock ///////////////////
#include <MC/ItemUseInventoryTransaction.hpp> #include <MC/ItemUseInventoryTransaction.hpp>
// 没有这个符号 // 符号变更
// TInstanceHook(char, "?checkBlockPermissions@BlockSource@@QEAA_NAEAVActor@@AEBVBlockPos@@EAEBVItemStackBase@@_N@Z", TInstanceHook(char, "?checkBlockPermissions@BlockSource@@QEAA_NAEAVActor@@AEBVBlockPos@@EAEBVItemStack@@_N@Z",
// BlockSource, Actor* ac, BlockPos* bp, unsigned __int8 facing, ItemStackBase* item, bool a6) { BlockSource, Actor* ac, BlockPos* bp, unsigned __int8 facing, ItemStackBase* item, bool a6) {
// if (ac->isPlayer()) { if (ac->isPlayer()) {
// IF_LISTENED(PlayerPlaceBlockEvent) { IF_LISTENED(PlayerPlaceBlockEvent) {
// auto pl = (Player*)ac; auto pl = (Player*)ac;
// PlayerPlaceBlockEvent ev{}; PlayerPlaceBlockEvent ev{};
// ev.mPlayer = pl; ev.mPlayer = pl;
// ev.mBlockInstance = this->getBlockInstance(*bp); ev.mBlockInstance = this->getBlockInstance(*bp);
// if (!ev.call()) { // this pointer is not used. if (!ev.call()) { // this pointer is not used.
// ((ItemUseInventoryTransaction*)nullptr)->resendBlocksAroundArea(*pl, *bp, facing); ((ItemUseInventoryTransaction*)nullptr)->resendBlocksAroundArea(*pl, *bp, facing);
// return false; return false;
// } }
// } }
// IF_LISTENED_END(PlayerPlaceBlockEvent) IF_LISTENED_END(PlayerPlaceBlockEvent)
// } }
// return original(this, ac, bp, facing, item, a6); return original(this, ac, bp, facing, item, a6);
// } }
/////////////////// BlockPlacedByPlayerEvent /////////////////// /////////////////// BlockPlacedByPlayerEvent ///////////////////
TClasslessInstanceHook(void, "?sendBlockPlacedByPlayer@BlockEventCoordinator@@QEAAXAEAVPlayer@@AEBVBlock@@AEBVBlockPos@@_N@Z", TClasslessInstanceHook(void, "?sendBlockPlacedByPlayer@BlockEventCoordinator@@QEAAXAEAVPlayer@@AEBVBlock@@AEBVBlockPos@@_N@Z",
@ -895,23 +893,22 @@ TInstanceHook(bool, "?useOn@SeedItemComponentLegacy@@QEAA_NAEAVItemStack@@AEAVAc
*/ */
/////////////////// PlayerOpenContainer /////////////////// /////////////////// PlayerOpenContainer ///////////////////
// 没有这个符号 // 符号更换
// TClasslessInstanceHook(__int64, "?onEvent@VanillaServerGameplayEventListener@@UEAA?AW4EventResult@@AEBUPlayerOpenContainerEvent@@@Z", void* a2) { TClasslessInstanceHook(__int64, "?onPlayerOpenContainer@VanillaServerGameplayEventListener@@UEAA?AW4EventResult@@AEAVPlayer@@W4ContainerType@@AEBVBlockPos@@UActorUniqueID@@@Z",
// Actor* pl = SymCall("??$tryUnwrap@VActor@@$$V@WeakEntityRef@@QEBAPEAVActor@@XZ", Actor*, void*)(a2); Player* pl, ContainerType type, BlockPos *pos,ActorUniqueID actorUniqueId) {
// if (pl->isPlayer()) { if (pl->isPlayer()) {
// IF_LISTENED(PlayerOpenContainerEvent) { IF_LISTENED(PlayerOpenContainerEvent) {
// BlockPos bp = dAccess<BlockPos>(a2, 28); PlayerOpenContainerEvent ev{};
// PlayerOpenContainerEvent ev{}; ev.mPlayer = pl;
// ev.mPlayer = (Player*)pl; ev.mBlockInstance = Level::getBlockInstance(pos, pl->getDimensionId());
// ev.mBlockInstance = Level::getBlockInstance(bp, pl->getDimensionId()); ev.mContainer = ev.mBlockInstance.getContainer();
// ev.mContainer = ev.mBlockInstance.getContainer(); if (!ev.call())
// if (!ev.call()) return 0;
// return 0; }
// } IF_LISTENED_END(PlayerOpenContainerEvent)
// IF_LISTENED_END(PlayerOpenContainerEvent) }
// } return original(this, pl,type,pos,actorUniqueId);
// return original(this, a2); }
// }
/////////////////// PlayerCloseContainer /////////////////// /////////////////// PlayerCloseContainer ///////////////////
// chest // chest
@ -934,7 +931,7 @@ TInstanceHook(bool, "?stopOpen@ChestBlockActor@@UEAAXAEAVPlayer@@@Z",
TClasslessInstanceHook(bool, "?stopOpen@BarrelBlockActor@@UEAAXAEAVPlayer@@@Z", TClasslessInstanceHook(bool, "?stopOpen@BarrelBlockActor@@UEAAXAEAVPlayer@@@Z",
Player* pl) { Player* pl) {
IF_LISTENED(PlayerCloseContainerEvent) { IF_LISTENED(PlayerCloseContainerEvent) {
BlockActor* ba = (BlockActor*)((char*)this - 240); // IDA ChestBlockActor::stopOpen BlockActor* ba = (BlockActor*)((char*)this - 248); // IDA ChestBlockActor::stopOpen
BlockPos bp = ba->getPosition(); BlockPos bp = ba->getPosition();
PlayerCloseContainerEvent ev{}; PlayerCloseContainerEvent ev{};
@ -965,20 +962,20 @@ TInstanceHook(void, "?inventoryChanged@Player@@UEAAXAEAVContainer@@HAEBVItemStac
} }
/////////////////// PlayerMove /////////////////// /////////////////// PlayerMove ///////////////////
// 没有这个符号 // 更改符号
// TClasslessInstanceHook(void, "?sendPlayerMove@PlayerEventCoordinator@@QEAAXAEAVPlayer@@@Z", TInstanceHook(void, "?move@Player@@UEAAXAEBVVec3@@@Z",
// Player* pl) { Player, Vec3* pos) {
// IF_LISTENED(PlayerMoveEvent) { IF_LISTENED(PlayerMoveEvent) {
// if (pl->isMoving()) { if (this->isMoving()) {
// PlayerMoveEvent ev{}; PlayerMoveEvent ev{};
// ev.mPlayer = pl; ev.mPlayer = this;
// ev.mPos = pl->getPosition(); ev.mPos = *pos;
// ev.call(); ev.call();
// } }
// } }
// IF_LISTENED_END(PlayerMoveEvent) IF_LISTENED_END(PlayerMoveEvent)
// return original(this, pl); return original(this, pos);
// } }
/////////////////// PlayerSprint /////////////////// /////////////////// PlayerSprint ///////////////////
TInstanceHook(void, "?setSprinting@Mob@@UEAAX_N@Z", TInstanceHook(void, "?setSprinting@Mob@@UEAAX_N@Z",
@ -1286,7 +1283,7 @@ TClasslessInstanceHook(bool, "?mayPlace@FireBlock@@UEBA_NAEAVBlockSource@@AEBVBl
/////////////////// RedStoneUpdate /////////////////// /////////////////// RedStoneUpdate ///////////////////
// 红石<EFBFBD>?? // 红石
TClasslessInstanceHook(void, "?onRedstoneUpdate@RedStoneWireBlock@@UEBAXAEAVBlockSource@@AEBVBlockPos@@H_N@Z", TClasslessInstanceHook(void, "?onRedstoneUpdate@RedStoneWireBlock@@UEBAXAEAVBlockSource@@AEBVBlockPos@@H_N@Z",
BlockSource* bs, BlockPos* bp, int level, bool isActive) { BlockSource* bs, BlockPos* bp, int level, bool isActive) {
IF_LISTENED(RedStoneUpdateEvent) { IF_LISTENED(RedStoneUpdateEvent) {
@ -1318,7 +1315,7 @@ TClasslessInstanceHook(void, "?onRedstoneUpdate@RedstoneTorchBlock@@UEBAXAEAVBlo
IF_LISTENED_END(RedStoneUpdateEvent) IF_LISTENED_END(RedStoneUpdateEvent)
return original(this, bs, bp, level, isActive); return original(this, bs, bp, level, isActive);
} }
// 红石中继<EFBFBD>?? // 红石中继
TClasslessInstanceHook(void, "?onRedstoneUpdate@DiodeBlock@@UEBAXAEAVBlockSource@@AEBVBlockPos@@H_N@Z", TClasslessInstanceHook(void, "?onRedstoneUpdate@DiodeBlock@@UEBAXAEAVBlockSource@@AEBVBlockPos@@H_N@Z",
BlockSource* bs, BlockPos* bp, int level, bool isActive) { BlockSource* bs, BlockPos* bp, int level, bool isActive) {
IF_LISTENED(RedStoneUpdateEvent) { IF_LISTENED(RedStoneUpdateEvent) {
@ -1334,7 +1331,7 @@ TClasslessInstanceHook(void, "?onRedstoneUpdate@DiodeBlock@@UEBAXAEAVBlockSource
IF_LISTENED_END(RedStoneUpdateEvent) IF_LISTENED_END(RedStoneUpdateEvent)
return original(this, bs, bp, level, isActive); return original(this, bs, bp, level, isActive);
} }
// 红石比较<EFBFBD>?? // 红石比较
TClasslessInstanceHook(void, "?onRedstoneUpdate@ComparatorBlock@@UEBAXAEAVBlockSource@@AEBVBlockPos@@H_N@Z", TClasslessInstanceHook(void, "?onRedstoneUpdate@ComparatorBlock@@UEBAXAEAVBlockSource@@AEBVBlockPos@@H_N@Z",
BlockSource* bs, BlockPos* bp, int level, bool isActive) { BlockSource* bs, BlockPos* bp, int level, bool isActive) {
IF_LISTENED(RedStoneUpdateEvent) { IF_LISTENED(RedStoneUpdateEvent) {
@ -1354,26 +1351,26 @@ TClasslessInstanceHook(void, "?onRedstoneUpdate@ComparatorBlock@@UEBAXAEAVBlockS
/////////////////// HopperSearchItem /////////////////// /////////////////// HopperSearchItem ///////////////////
// 没有这个符号 // 没有这个符号
// TClasslessInstanceHook(bool, "?_tryPullInItemsFromAboveContainer@Hopper@@IEAA_NAEAVBlockSource@@AEAVContainer@@AEBVVec3@@@Z", TClasslessInstanceHook(bool, "?_pullInItems@Hopper@@IEAA_NAEAVBlockSource@@AEAVContainer@@AEBVVec3@@@Z",
// BlockSource* bs, void* container, Vec3* pos) { BlockSource* bs, void* container, Vec3* pos) {
// bool isMinecart = dAccess<bool>(this, 5); // IDA Hopper::Hopper bool isMinecart = dAccess<bool>(this, 5); // IDA Hopper::Hopper
// IF_LISTENED(HopperSearchItemEvent) { IF_LISTENED(HopperSearchItemEvent) {
// HopperSearchItemEvent ev{}; HopperSearchItemEvent ev{};
// if (isMinecart) { if (isMinecart) {
// ev.isMinecart = true; ev.isMinecart = true;
// ev.mMinecartPos = *pos; ev.mMinecartPos = *pos;
// } else { } else {
// ev.isMinecart = false; ev.isMinecart = false;
// ev.mHopperBlock = Level::getBlockInstance(pos->toBlockPos(), bs); ev.mHopperBlock = Level::getBlockInstance(pos->toBlockPos(), bs);
// } }
// ev.mDimensionId = bs->getDimensionId(); ev.mDimensionId = bs->getDimensionId();
// if (!ev.call()) if (!ev.call())
// return false; return false;
// } }
// IF_LISTENED_END(HopperSearchItemEvent) IF_LISTENED_END(HopperSearchItemEvent)
// return original(this, bs, container, pos); return original(this, bs, container, pos);
// } }
/////////////////// HopperPushOut /////////////////// /////////////////// HopperPushOut ///////////////////
TClasslessInstanceHook(bool, "?_pushOutItems@Hopper@@IEAA_NAEAVBlockSource@@AEAVContainer@@AEBVVec3@@H@Z", TClasslessInstanceHook(bool, "?_pushOutItems@Hopper@@IEAA_NAEAVBlockSource@@AEAVContainer@@AEBVVec3@@H@Z",
@ -1440,20 +1437,20 @@ TClasslessInstanceHook(void, "?transformOnFall@FarmBlock@@UEBAXAEAVBlockSource@@
/////////////////// PlayerUseFrameBlockEvent /////////////////// /////////////////// PlayerUseFrameBlockEvent ///////////////////
// 没有这个符号 // 符号变更
// TClasslessInstanceHook(bool, "?use@ItemFrameBlock@@UEBA_NAEAVPlayer@@AEBVBlockPos@@E@Z", TClasslessInstanceHook(bool, "?use@ItemFrameBlock@@UEBA_NAEAVPlayer@@AEBVBlockPos@@@Z",
// Player* a2, BlockPos* a3) { Player* a2, BlockPos* a3) {
// IF_LISTENED(PlayerUseFrameBlockEvent) { IF_LISTENED(PlayerUseFrameBlockEvent) {
// PlayerUseFrameBlockEvent ev{}; PlayerUseFrameBlockEvent ev{};
// ev.mType = PlayerUseFrameBlockEvent::Type::Use; ev.mType = PlayerUseFrameBlockEvent::Type::Use;
// ev.mBlockInstance = Level::getBlockInstance(a3, a2->getDimensionId()); ev.mBlockInstance = Level::getBlockInstance(a3, a2->getDimensionId());
// ev.mPlayer = a2; ev.mPlayer = a2;
// if (!ev.call()) if (!ev.call())
// return false; return false;
// } }
// IF_LISTENED_END(PlayerUseFrameBlockEvent) IF_LISTENED_END(PlayerUseFrameBlockEvent)
// return original(this, a2, a3); return original(this, a2, a3);
// } }
TClasslessInstanceHook(bool, "?attack@ItemFrameBlock@@UEBA_NPEAVPlayer@@AEBVBlockPos@@@Z", TClasslessInstanceHook(bool, "?attack@ItemFrameBlock@@UEBA_NPEAVPlayer@@AEBVBlockPos@@@Z",
Player* a2, BlockPos* a3) { Player* a2, BlockPos* a3) {
@ -1776,39 +1773,39 @@ TClasslessInstanceHook(void, "?explode@Explosion@@QEAAXXZ") {
////////////// WitherBossDestroy ////////////// ////////////// WitherBossDestroy //////////////
// 没有这个符号 // 没有这个符号
// TInstanceHook(void, "?_destroyBlocks@WitherBoss@@AEAAXAEAVLevel@@AEBVAABB@@AEAVBlockSource@@HW4WitherAttackType@1@@Z", THook(void, "?destroyBlocks@@YAXAEAVLevel@@AEBVAABB@@AEAVBlockSource@@H@Z",
// Actor, Level* a2, AABB* aabb, BlockSource* a4, int a5, unsigned int a6) { Level* level, AABB* aabb, BlockSource* bs, int range) {
// IF_LISTENED(WitherBossDestroyEvent) { IF_LISTENED(WitherBossDestroyEvent) {
// WitherBossDestroyEvent ev{}; WitherBossDestroyEvent ev{};
// ev.mWitherBoss = (WitherBoss*)this; ev.mWitherBoss = dAccess<WitherBoss*>(level,-102); // WitherBoss::newServerAiStep Line515
// ev.mDestroyRange = *aabb; ev.mDestroyRange = *aabb;
// if (!ev.call()) if (!ev.call())
// return; return;
// *aabb = ev.mDestroyRange; *aabb = ev.mDestroyRange;
// } }
// IF_LISTENED_END(WitherBossDestroyEvent) IF_LISTENED_END(WitherBossDestroyEvent)
// original(this, a2, aabb, a4, a5, a6); original(level, aabb, bs, range);
// } }
////////////// EntityRide ////////////// ////////////// EntityRide //////////////
// 没有这个符号 // 没有这个符号
// TInstanceHook(bool, "?canAddPassenger@Actor@@UEBA_NAEAV1@@Z", TInstanceHook(bool, "?canAddRider@Actor@@UEBA_NAEAV1@@Z",
// Actor, Actor* a2) { Actor, Actor* a2) {
// auto rtn = original(this, a2); auto rtn = original(this, a2);
// if (!rtn) if (!rtn)
// return false; return false;
// IF_LISTENED(EntityRideEvent) { IF_LISTENED(EntityRideEvent) {
// EntityRideEvent ev{}; EntityRideEvent ev{};
// ev.mRider = a2; ev.mRider = a2;
// ev.mVehicle = this; ev.mVehicle = this;
// if (!ev.call()) if (!ev.call())
// return false; return false;
// } }
// IF_LISTENED_END(EntityRideEvent) IF_LISTENED_END(EntityRideEvent)
// return rtn; return rtn;
// } }
////////////// EntityStepOnPressurePlate ////////////// ////////////// EntityStepOnPressurePlate //////////////
@ -1981,25 +1978,25 @@ TClasslessInstanceHook(void, "?onScoreChanged@ServerScoreboard@@UEAAXAEBUScorebo
#include <MC/Minecraft.hpp> #include <MC/Minecraft.hpp>
////////////// ServerStarted ////////////// ////////////// ServerStarted //////////////
// 没有这个符号 // 没有这个符号
// TClasslessInstanceHook(void, "?sendServerThreadStarted@ServerInstanceEventCoordinator@@QEAAXAEAVServerInstance@@@Z", TClasslessInstanceHook(void, "?onServerThreadStarted@MinecraftServerScriptEngine@@UEAA?AW4EventResult@@AEAVServerInstance@@@Z",
// class ServerInstance& ins) { class ServerInstance& ins) {
// if(!LL::isDebugMode()) if(!LL::isDebugMode())
// _set_se_translator(seh_exception::TranslateSEHtoCE); _set_se_translator(seh_exception::TranslateSEHtoCE);
// LL::globalConfig.tickThreadId = std::this_thread::get_id(); LL::globalConfig.tickThreadId = std::this_thread::get_id();
// Global<Level> = Global<Minecraft>->getLevel(); Global<Level> = Global<Minecraft>->getLevel();
// Global<ServerLevel> = (ServerLevel*)Global<Minecraft>->getLevel(); Global<ServerLevel> = (ServerLevel*)Global<Minecraft>->getLevel();
// // Global<ServerNetworkHandler> = Global<Minecraft>->getServerNetworkHandler(); // Global<ServerNetworkHandler> = Global<Minecraft>->getServerNetworkHandler();
// LL::globalConfig.serverStatus = LL::LLServerStatus::Running; LL::globalConfig.serverStatus = LL::LLServerStatus::Running;
// IF_LISTENED(ServerStartedEvent) { IF_LISTENED(ServerStartedEvent) {
// ServerStartedEvent ev{}; ServerStartedEvent ev{};
// ev.call(); ev.call();
// } }
// IF_LISTENED_END(ServerStartedEvent) IF_LISTENED_END(ServerStartedEvent)
// original(this, ins); original(this, ins);
// } }
////////////// ServerStopped ////////////// ////////////// ServerStopped //////////////
TClasslessInstanceHook(void, "??1DedicatedServer@@UEAA@XZ") { TClasslessInstanceHook(void, "??1DedicatedServer@@UEAA@XZ") {
@ -2118,19 +2115,19 @@ TInstanceHook(int, "?startSleepInBed@Player@@UEAA?AW4BedSleepingResult@@AEBVBloc
#include <MC/Spawner.hpp> #include <MC/Spawner.hpp>
////////////// MobSpawn ////////////// ////////////// MobSpawn //////////////
// TInstanceHook(Mob*, "?spawnMob@Spawner@@QEAAPEAVMob@@AEAVBlockSource@@AEBUActorDefinitionIdentifier@@PEAVActor@@AEBVVec3@@_N44@Z", TInstanceHook(Mob*, "?spawnMob@Spawner@@QEAAPEAVMob@@AEAVBlockSource@@AEBUActorDefinitionIdentifier@@PEAVActor@@AEBVVec3@@_N44@Z",
// Spawner, BlockSource* a2, ActorDefinitionIdentifier* a3, Actor* a4, Vec3& a5, bool a6, bool a7, bool a8) { Spawner, BlockSource* a2, ActorDefinitionIdentifier* a3, Actor* a4, Vec3& a5, bool a6, bool a7, bool a8) {
// IF_LISTENED(MobSpawnEvent) { IF_LISTENED(MobSpawnEvent) {
// MobSpawnEvent ev{}; MobSpawnEvent ev{};
// ev.mTypeName = a3->getCanonicalName(); ev.mTypeName = a3->getCanonicalName();
// ev.mPos = a5; ev.mPos = a5;
// ev.mDimensionId = a2->getDimensionId(); ev.mDimensionId = a2->getDimensionId();
// if (!ev.call()) if (!ev.call())
// return nullptr; return nullptr;
// } }
// IF_LISTENED_END(MobSpawnEvent) IF_LISTENED_END(MobSpawnEvent)
// return original(this, a2, a3, a4, a5, a6, a7, a8); return original(this, a2, a3, a4, a5, a6, a7, a8);
// } }
#include "Impl/FormPacketHelper.h" #include "Impl/FormPacketHelper.h"
#include <MC/Json.hpp> #include <MC/Json.hpp>