mirror of
https://github.com/quizhizhe/LiteLoaderBDS-1.16.40.git
synced 2025-06-01 19:53:41 +00:00
把偏移量集中
This commit is contained in:
parent
6d752996a5
commit
7007106d39
158
LiteLoader/include/liteloader/Offset.h
Normal file
158
LiteLoader/include/liteloader/Offset.h
Normal file
@ -0,0 +1,158 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
|
||||
/*
|
||||
* 偏移量命名规则:使用的文件名_函数名_(如有多个)第几个使用或者知道的成员名
|
||||
* */
|
||||
|
||||
namespace ll{
|
||||
namespace offset{
|
||||
|
||||
// ->header/llapi/mc
|
||||
|
||||
// Null
|
||||
constexpr uint64_t ATTRIBUTE_getName = 0x8;
|
||||
// BaseCommandBlock::_setCommand a4 is Command
|
||||
constexpr uint64_t BASECOMMANDBLOCK_getCommand = 0x38;
|
||||
// ItemStackBase::init(ItemStackBase*, BlockLegacy *, int) Line14
|
||||
constexpr uint64_t BLOCKLEGAC_getBlockItemId = 0x10C;
|
||||
// LevelChunk::_removeCallbacks Line28
|
||||
constexpr uint64_t BLOCKLEGAC_getBlockEntityType = 0xA8;
|
||||
// Null
|
||||
constexpr uint64_t BLOCKSOURCE_getDimension = 0x20;
|
||||
// BegGoal::canUse Line6
|
||||
constexpr uint64_t BLOCKSOURCE_getDimensionConst = 0x328;
|
||||
// DayLockCommand::execute Line91
|
||||
constexpr uint64_t COMMANDOUTPUT_getSuccessCount = 0x28;
|
||||
// Null
|
||||
constexpr uint64_t COMPOUNDTAGVARIANT_getTagType = 0x28;
|
||||
// ExplorationMapFunction::apply Line57
|
||||
constexpr uint64_t DIMENSION_getBlockSourceFromMainChunkSource = 0x48;
|
||||
// Null
|
||||
constexpr uint64_t DIMENSION_getHeight = 0xCA;
|
||||
// Player::checkSpawnBlock Line19
|
||||
constexpr uint64_t DIMENSION_getDimensionId = 0xC0;
|
||||
// ItemRegistry::registerItem Line25
|
||||
constexpr uint64_t ITEM_getFullItemName = 0xD8;
|
||||
// Null
|
||||
constexpr uint64_t LEVEL_getSpawner = 0x7B0;
|
||||
// CommandAreaFactory::_getArea Line156
|
||||
constexpr uint64_t LEVELCHUNK_getLastTick = 0x90;
|
||||
// lambda_b490644342a3912d59dc52eb79c3a67f_::operator() Line410
|
||||
constexpr uint64_t MINECRAFT_getNetworkHandler = 0x18;
|
||||
// mob::die Line83
|
||||
constexpr uint64_t MOB_getDead = 0x73A;
|
||||
// EffectCommand::execute Line247
|
||||
constexpr uint64_t MOBEFFECT_getResourceName = 0x50;
|
||||
// MobEffect::MobEffect Line43
|
||||
constexpr uint64_t MOBEFFECT_getComponentName = 0x98;
|
||||
// ScoreboardCommand::applyPlayerOperation Line186
|
||||
constexpr uint64_t OBJECTIVE_getName = 0x40;
|
||||
// Objective::serialize Line55
|
||||
constexpr uint64_t OBJECTIVE_getDisplayName = 0x60;
|
||||
// Null
|
||||
constexpr uint64_t PACKET_OBJECTIVE_getDisplayName = 0x10;
|
||||
// AddPlayerPacket::AddPlayerPacket Line58
|
||||
constexpr uint64_t PLAYER_getDeviceId = 0x1EC0;
|
||||
// Actor::onAboveBubbleColumn Line5 照抄的,不知行不行
|
||||
constexpr uint64_t PLAYER_isFlying_1 = 0x8B4;
|
||||
constexpr uint64_t PLAYER_isFlying_2 = 0x8B8;
|
||||
constexpr uint64_t PLAYER_isFlying_3 = 0x914;
|
||||
constexpr uint64_t PLAYER_isFlying_4 = 0x918;
|
||||
// PropertiesSettings::PropertiesSettings Line550
|
||||
constexpr uint64_t PROPERTIESSETTINGS_useOnlineAuthentication = 0x1A1;
|
||||
// PropertiesSettings::PropertiesSettings Line518
|
||||
constexpr uint64_t PROPERTIESSETTINGS_getLevelName = 0x20;
|
||||
// Null
|
||||
constexpr uint64_t RAKNET_getAdr = 0x8;
|
||||
// ResourcePackRepository::_initializeWorldPackSource Line62
|
||||
constexpr uint64_t RESOURCEPACKREPOSITORY_getPackSourceFactory = 0x170;
|
||||
// ServerScoreboard::_unpackIdentityDefToScorePacket Line30~31 16+72
|
||||
constexpr uint64_t SCOREBOARDIDENTITYREF_getIdentityType = 0x58;
|
||||
|
||||
// ->src/EventAPI
|
||||
|
||||
// Null
|
||||
constexpr uint64_t EVENTAPI_PlayerInteractEntity_1 = 0x68;
|
||||
// Null
|
||||
constexpr uint64_t EVENTAPI_PlayerInteractEntity_2 = 0x70;
|
||||
// Hopper::Hopper
|
||||
constexpr uint64_t EVENTAPI_HopperSearchItem = 0x5;
|
||||
|
||||
// ->src/llapi/mc
|
||||
|
||||
// Null
|
||||
constexpr uint64_t BIOMEAPI_getID = 0x78;
|
||||
// Null
|
||||
constexpr uint64_t BIOMEAPI_getName = 0x8;
|
||||
// Null
|
||||
constexpr uint64_t BLOCKAPI_getTileData = 0x8;
|
||||
// Actor::_playFlySound Line7
|
||||
constexpr uint64_t BLOCKAPI_getRuntimeId = 0x30;
|
||||
// Null
|
||||
constexpr uint64_t BLOCKLEGACYAPI_getRuntimeId = 0x80;
|
||||
// Container::Container
|
||||
constexpr uint64_t CONTAINERAPI_getTypeName= 0x8;
|
||||
// Null
|
||||
constexpr uint64_t GAMEMODEAPI_getPlayer= 0x8;
|
||||
// Null
|
||||
constexpr uint64_t HITRESULTAPI_getFacing= 0x1C;
|
||||
// Null
|
||||
constexpr uint64_t HITRESULTAPI_getPos= 0x2C;
|
||||
// Null
|
||||
constexpr uint64_t HITRESULTAPI_isHitLiquid= 0x50;
|
||||
// Null
|
||||
constexpr uint64_t HITRESULTAPI_getBlockPos= 0x20;
|
||||
// Null
|
||||
constexpr uint64_t HITRESULTAPI_getLiquidPos= 0x54;
|
||||
// Null
|
||||
constexpr uint64_t HITRESULTAPI_getLiquidFacing= 0x51;
|
||||
// Player::take Line127
|
||||
constexpr uint64_t ITEMACTORAPI_getItemStack= 0x620;
|
||||
// ItemActor::NormalTick Line258
|
||||
constexpr uint64_t ITEMACTORAPI_getDespawnTime = 0x6C4;
|
||||
// ItemActor::NormalTick Line258 也许是?
|
||||
constexpr uint64_t ITEMACTORAPI_getLatestSpawnTime = 0x6B0;
|
||||
// Null
|
||||
constexpr uint64_t ITEMSTACKAPI_getCount = 0x22;
|
||||
// MovingBlockActor::load Line69
|
||||
constexpr uint64_t LEVELAPI_getBlockPalettePtr = 0x7D0;
|
||||
// ServerPlayer::isHostingPlayer
|
||||
constexpr uint64_t PLAYERAPI_getNetworkIdentifier = 0x980;
|
||||
// KickCommand::_kickPlayer Line116
|
||||
constexpr uint64_t PLAYERAPI_getCertificate = 0xAB0;
|
||||
// AddPlayerPacket::AddPlayerPacket Line59
|
||||
constexpr uint64_t PLAYERAPI_getPlatform = 0x838;
|
||||
// InventoryContainerModel::_getContainer 2928 + 176
|
||||
constexpr uint64_t PLAYERAPI_getInventory = 0xC20;
|
||||
// ServerNetworkHandler::_sendLevelData Line316
|
||||
constexpr uint64_t PLAYERAPI_getSpawnPosition = 0x1C14;
|
||||
// ServerNetworkHandler::_sendLevelData Line310
|
||||
constexpr uint64_t PLAYERAPI_getSpawnDimension = 0x1C20;
|
||||
// Null
|
||||
constexpr uint64_t PLAYERAPI_getClientUUID = 0xAA0;
|
||||
// ServerPlayer::sendNetworkPacket 参4
|
||||
constexpr uint64_t PLAYERAPI_getClientSubId = 0xDC0;
|
||||
// Null
|
||||
constexpr uint64_t PLAYERAPI_crashClient = 0X38;
|
||||
// Null
|
||||
constexpr uint64_t PLAYERAPI_sendTransferPacket_port = 0X24;
|
||||
// Null
|
||||
constexpr uint64_t PLAYERAPI_sendTransferPacket_address = 0X28;
|
||||
// Null
|
||||
constexpr uint64_t PLAYERAPI_sendSetScorePacket_type = 0X30;
|
||||
// Null
|
||||
constexpr uint64_t PLAYERAPI_sendSetScorePacket_data = 0X38;
|
||||
// Null
|
||||
constexpr uint64_t PLAYERAPI_sendCommandRequestPacket_cmd = 0X30;
|
||||
// Null
|
||||
constexpr uint64_t RESOURCEPACKREPOSITORYAPI_setCustomResourcePackPath = 0x30;
|
||||
|
||||
// ->src/llapi/nbt
|
||||
|
||||
// Block::Block?
|
||||
constexpr uint64_t COMPOUNDTAGAPI_fromBlock = 0x18;
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,15 @@
|
||||
#pragma once
|
||||
#include "Global.h"
|
||||
#include "utils/Hash.h"
|
||||
#include <ModUtils/ModUtils.h>
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
#include <ModUtils/ModUtils.h>
|
||||
#include <liteloader/Offset.h>
|
||||
|
||||
#include "Global.h"
|
||||
#include "utils/Hash.h"
|
||||
|
||||
// The core api of the hook function
|
||||
//__declspec(dllimport) int HookFunction(void* oldfunc, void** poutold, void* newfunc);
|
||||
// Used to get a server-defined specific function by name
|
||||
|
@ -12,7 +12,7 @@ class Attribute {
|
||||
#define AFTER_EXTRA
|
||||
public:
|
||||
inline class HashedString const & getName() const{
|
||||
return dAccess<HashedString>(this, 8);
|
||||
return dAccess<HashedString>(this, ll::offset::ATTRIBUTE_getName);
|
||||
}
|
||||
|
||||
#undef AFTER_EXTRA
|
||||
|
@ -13,7 +13,7 @@ class BaseCommandBlock {
|
||||
public:
|
||||
inline std::string const & getCommand() const{
|
||||
//BaseCommandBlock::_setCommand a4 is Command;
|
||||
return dAccess<std::string>(this,56);
|
||||
return dAccess<std::string>(this,ll::offset::BASECOMMANDBLOCK_getCommand);
|
||||
};
|
||||
#undef AFTER_EXTRA
|
||||
#ifndef DISABLE_CONSTRUCTOR_PREVENTION_BASECOMMANDBLOCK
|
||||
|
@ -163,7 +163,7 @@ public:
|
||||
|
||||
inline int getBlockItemId() const{
|
||||
//ItemStackBase::init(ItemStackBase *this, const struct BlockLegacy *a2, int a3) Line14
|
||||
unsigned int id = dAccess<int>(this,268);//mID
|
||||
unsigned int id = dAccess<int>(this,ll::offset::BLOCKLEGAC_getBlockItemId);//mID
|
||||
// unsigned int id = this->mID;
|
||||
if(id < 256u)
|
||||
return id;
|
||||
@ -176,7 +176,7 @@ public:
|
||||
}
|
||||
inline enum BlockActorType getBlockEntityType() const{
|
||||
// LevelChunk::_removeCallbacks Line28
|
||||
return dAccess<BlockActorType>(this,168);
|
||||
return dAccess<BlockActorType>(this,ll::offset::BLOCKLEGAC_getBlockEntityType);
|
||||
//return this->mBlockEntityType;
|
||||
};
|
||||
|
||||
|
@ -22,7 +22,7 @@ public:
|
||||
// };
|
||||
LIAPI BlockInstance getBlockInstance(BlockPos);
|
||||
inline Dimension* getDimension() const{
|
||||
return dAccess< Dimension*>(this, 32);
|
||||
return dAccess< Dimension*>(this, ll::offset::BLOCKSOURCE_getDimension);
|
||||
}
|
||||
inline AutomaticID<class Dimension, int> getDimensionId() const{
|
||||
//Dimension::onBlockEvent Line24
|
||||
@ -42,7 +42,7 @@ public:
|
||||
}
|
||||
inline Dimension const & getDimensionConst() const{
|
||||
//BegGoal::canUse Line6
|
||||
return dAccess<Dimension>(this,808);
|
||||
return dAccess<Dimension>(this,ll::offset::BLOCKSOURCE_getDimensionConst);
|
||||
};
|
||||
// inline short getHeightmap(class BlockPos const &bs) const{
|
||||
// auto levelchunk = getChunkAt(bs);
|
||||
|
@ -23,13 +23,13 @@ public:
|
||||
|
||||
inline int getSuccessCount() const{
|
||||
//DayLockCommand::execute Line91
|
||||
return dAccess<int>(this,0x28);
|
||||
return dAccess<int>(this,ll::offset::COMMANDOUTPUT_getSuccessCount);
|
||||
};
|
||||
|
||||
inline void success(){
|
||||
int successCount = dAccess<int>(this,0x28);
|
||||
int successCount = dAccess<int>(this,ll::offset::COMMANDOUTPUT_getSuccessCount);
|
||||
++successCount;
|
||||
dAccess<int>(this,0x28) = successCount;
|
||||
dAccess<int>(this,ll::offset::COMMANDOUTPUT_getSuccessCount) = successCount;
|
||||
};
|
||||
|
||||
inline bool empty() const{
|
||||
|
@ -12,7 +12,7 @@ class CompoundTagVariant {
|
||||
#define AFTER_EXTRA
|
||||
public:
|
||||
inline Tag::Type getTagType() {
|
||||
return dAccess<Tag::Type, 40>(this);
|
||||
return dAccess<Tag::Type, ll::offset::COMPOUNDTAGVARIANT_getTagType>(this);
|
||||
}
|
||||
inline Tag* asTag() {
|
||||
return (Tag*)this;
|
||||
|
@ -22,15 +22,15 @@ class Dimension {
|
||||
public:
|
||||
inline BlockSource& getBlockSourceFromMainChunkSource() const{
|
||||
//ExplorationMapFunction::apply Line57
|
||||
return *dAccess<BlockSource*>(this, 72);
|
||||
return *dAccess<BlockSource*>(this, ll::offset::DIMENSION_getBlockSourceFromMainChunkSource);
|
||||
};
|
||||
inline int getHeight(){
|
||||
return dAccess<int>(this,202);
|
||||
return dAccess<int>(this,ll::offset::DIMENSION_getHeight);
|
||||
};
|
||||
inline AutomaticID<class Dimension, int> getDimensionId() const{
|
||||
//Player::moveSpawnView Line33
|
||||
//Player::checkSpawnBlock Line19
|
||||
return dAccess<AutomaticID<Dimension,int>>(this,192);
|
||||
return dAccess<AutomaticID<Dimension,int>>(this,ll::offset::DIMENSION_getDimensionId);
|
||||
};
|
||||
inline DimensionHeightRange const & getHeightRange() const{
|
||||
// 0为主世界,1为下界,2为末地
|
||||
|
@ -20,7 +20,7 @@ class Item {
|
||||
public:
|
||||
inline std::string const & getFullItemName() const{
|
||||
//ItemRegistry::registerItem Line25
|
||||
return dAccess<std::string>(this,216);
|
||||
return dAccess<std::string>(this,ll::offset::ITEM_getFullItemName);
|
||||
};
|
||||
#undef AFTER_EXTRA
|
||||
#ifndef DISABLE_CONSTRUCTOR_PREVENTION_ITEM
|
||||
|
@ -143,7 +143,7 @@ public:
|
||||
}
|
||||
|
||||
inline Spawner& getSpawner() const{
|
||||
return *dAccess<std::unique_ptr<Spawner>>(this,1968).get();
|
||||
return *dAccess<std::unique_ptr<Spawner>>(this,ll::offset::LEVEL_getSpawner).get();
|
||||
};
|
||||
|
||||
#undef AFTER_EXTRA
|
||||
|
@ -42,7 +42,7 @@ struct HardcodedSpawningArea {
|
||||
public:
|
||||
struct Tick const & getLastTick() const{
|
||||
//CommandAreaFactory::_getArea Line156
|
||||
return *dAccess<Tick*>(this, 144);
|
||||
return *dAccess<Tick*>(this, ll::offset::LEVELCHUNK_getLastTick);
|
||||
};
|
||||
inline int getHeightmap(const ChunkBlockPos *pos){
|
||||
//LevelChunk::_lightingCallbacks Line31 应该是这样的
|
||||
|
@ -14,7 +14,7 @@ class Minecraft {
|
||||
public:
|
||||
inline NetworkHandler & getNetworkHandler(){
|
||||
//lambda_b490644342a3912d59dc52eb79c3a67f_::operator() Line410
|
||||
return dAccess<NetworkHandler>(this,24);
|
||||
return dAccess<NetworkHandler>(this,ll::offset::MINECRAFT_getNetworkHandler);
|
||||
};
|
||||
#undef AFTER_EXTRA
|
||||
#ifndef DISABLE_CONSTRUCTOR_PREVENTION_MINECRAFT
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
}
|
||||
inline bool getDead(){
|
||||
//mob::die Line83
|
||||
return dAccess<bool>(this,1850);
|
||||
return dAccess<bool>(this,ll::offset::MOB_getDead);
|
||||
};
|
||||
|
||||
#undef AFTER_EXTRA
|
||||
|
@ -53,11 +53,11 @@ public:
|
||||
|
||||
inline std::string const & getResourceName() const{
|
||||
//EffectCommand::execute Line247
|
||||
return dAccess<std::string>(this,80);
|
||||
return dAccess<std::string>(this,ll::offset::MOBEFFECT_getResourceName);
|
||||
};
|
||||
inline HashedString const & getComponentName() const{
|
||||
//MobEffect::MobEffect Line43;
|
||||
return dAccess<HashedString>(this,152);
|
||||
return dAccess<HashedString>(this,ll::offset::MOBEFFECT_getComponentName);
|
||||
};
|
||||
|
||||
#undef AFTER_EXTRA
|
||||
|
@ -14,14 +14,14 @@ class Objective {
|
||||
public:
|
||||
inline std::string getName(){
|
||||
//ScoreboardCommand::applyPlayerOperation Line186
|
||||
return dAccess<std::string>(this, 64);
|
||||
return dAccess<std::string>(this, ll::offset::OBJECTIVE_getName);
|
||||
};
|
||||
|
||||
LIAPI bool setDisplay(const std::string& slotName, ObjectiveSortOrder sort);
|
||||
|
||||
inline std::string const & getDisplayName() const{
|
||||
//Objective::serialize
|
||||
return dAccess<std::string>(this,96);
|
||||
return dAccess<std::string>(this,ll::offset::OBJECTIVE_getDisplayName);
|
||||
};
|
||||
|
||||
#undef AFTER_EXTRA
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
|
||||
inline ServerPlayer* getPlayerFromPacket(ServerNetworkHandler* handler, NetworkIdentifier* netId)
|
||||
{
|
||||
return handler->getServerPlayer(*netId, dAccess<char>(this, 16));
|
||||
return handler->getServerPlayer(*netId, dAccess<char>(this, ll::offset::PACKET_OBJECTIVE_getDisplayName));
|
||||
}
|
||||
inline enum StreamReadResult _read(class ReadOnlyBinaryStream& binaryStream)
|
||||
{
|
||||
|
@ -184,11 +184,13 @@ public:
|
||||
}
|
||||
inline std::string* getDeviceId(){
|
||||
//AddPlayerPacket::AddPlayerPacket Line58
|
||||
return dAccess<std::string*>(this,7872);
|
||||
return dAccess<std::string*>(this,ll::offset::PLAYER_getDeviceId);
|
||||
};
|
||||
inline bool isFlying(){
|
||||
//Actor::onAboveBubbleColumn Line5 照抄的,不知行不行
|
||||
return (dAccess<int>(this,2228) == 1 || !dAccess<bool>(this,2232)) && (dAccess<int>(this, 2324) == 1 || !dAccess<bool>(this, 2328));
|
||||
return (dAccess<int>(this,ll::offset::PLAYER_isFlying_1) == 1
|
||||
|| !dAccess<bool>(this,ll::offset::PLAYER_isFlying_2))
|
||||
&& (dAccess<int>(this, ll::offset::PLAYER_isFlying_3) == 1 || !dAccess<bool>(this, ll::offset::PLAYER_isFlying_4));
|
||||
};
|
||||
inline bool isHungry(){
|
||||
void* Player_HUNGER = dlsym("?HUNGER@Player@@2VAttribute@@B");
|
||||
|
@ -13,11 +13,11 @@ class PropertiesSettings {
|
||||
public:
|
||||
inline bool useOnlineAuthentication(){
|
||||
//PropertiesSettings::PropertiesSettings Line550;
|
||||
return dAccess<bool>(this, 417);
|
||||
return dAccess<bool>(this, ll::offset::PROPERTIESSETTINGS_useOnlineAuthentication);
|
||||
}
|
||||
inline std::string getLevelName(){
|
||||
//PropertiesSettings::PropertiesSettings Line518
|
||||
return dAccess<std::string>(this,32);
|
||||
return dAccess<std::string>(this,ll::offset::PROPERTIESSETTINGS_getLevelName);
|
||||
}
|
||||
#undef AFTER_EXTRA
|
||||
#ifndef DISABLE_CONSTRUCTOR_PREVENTION_PROPERTIESSETTINGS
|
||||
|
@ -41,7 +41,7 @@ namespace RakNet {
|
||||
RakPeer(RakPeer const&) = delete;
|
||||
RakPeer(RakPeer&&) = delete;
|
||||
SystemAddress getAdr(NetworkIdentifier const& ni) {
|
||||
RakNetGUID const& guid = dAccess<RakNetGUID>(&ni, 8);
|
||||
RakNetGUID const& guid = dAccess<RakNetGUID>(&ni, ll::offset::RAKNET_getAdr);
|
||||
return RakPeer::GetSystemAddressFromGuid(guid);
|
||||
}
|
||||
MCAPI virtual SystemAddress GetSystemAddressFromGuid(struct RakNet::RakNetGUID) const;
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
|
||||
inline class PackSourceFactory* getPackSourceFactory(){
|
||||
//ResourcePackRepository::_initializeWorldPackSource Line62
|
||||
return dAccess<PackSourceFactory*>(this, 46 * 8);
|
||||
return dAccess<PackSourceFactory*>(this, ll::offset::RESOURCEPACKREPOSITORY_getPackSourceFactory);
|
||||
};
|
||||
#undef AFTER_EXTRA
|
||||
#ifndef DISABLE_CONSTRUCTOR_PREVENTION_RESOURCEPACKREPOSITORY
|
||||
|
@ -13,7 +13,7 @@ class ScoreboardIdentityRef {
|
||||
public:
|
||||
enum IdentityDefinition::Type getIdentityType(){
|
||||
//ServerScoreboard::_unpackIdentityDefToScorePacket Line30~31 16+72
|
||||
return dAccess<enum IdentityDefinition::Type>(this, 88);
|
||||
return dAccess<enum IdentityDefinition::Type>(this, ll::offset::SCOREBOARDIDENTITYREF_getIdentityType);
|
||||
};
|
||||
|
||||
#undef AFTER_EXTRA
|
||||
|
@ -1129,8 +1129,8 @@ TInstanceHook(void, "?handle@ItemUseOnActorInventoryTransaction@@UEBA?AW4Invento
|
||||
IF_LISTENED(PlayerInteractEntityEvent) {
|
||||
PlayerInteractEntityEvent ev{};
|
||||
ev.mPlayer = sp;
|
||||
ev.mTargetId = dAccess<ActorRuntimeID, 104>(this);//正确
|
||||
ev.mInteractiveMode = static_cast<PlayerInteractEntityEvent::InteractiveMode>(dAccess<int, 112>(this));//看起来应该正确
|
||||
ev.mTargetId = dAccess<ActorRuntimeID, ll::offset::EVENTAPI_PlayerInteractEntity_1>(this);//正确
|
||||
ev.mInteractiveMode = static_cast<PlayerInteractEntityEvent::InteractiveMode>(dAccess<int, ll::offset::EVENTAPI_PlayerInteractEntity_2>(this));//看起来应该正确
|
||||
if (!ev.call())
|
||||
return;
|
||||
}
|
||||
|
@ -5,11 +5,11 @@
|
||||
#include <llapi/HookAPI.h>
|
||||
|
||||
int Biome::getId() const {
|
||||
return dAccess<int, 120>(this);
|
||||
return dAccess<int, ll::offset::BIOMEAPI_getID>(this);
|
||||
}
|
||||
|
||||
std::string const& Biome::getName() const {
|
||||
return dAccess<std::string, 8>(this);
|
||||
return dAccess<std::string, ll::offset::BIOMEAPI_getName>(this);
|
||||
}
|
||||
|
||||
// Biome* Biome::fromId(int id) {
|
||||
|
@ -34,7 +34,7 @@ string Block::getTypeName() const {
|
||||
|
||||
unsigned short Block::getTileData() {
|
||||
// 等待大佬改进
|
||||
auto tileData = dAccess<unsigned short, 8>(this);
|
||||
auto tileData = dAccess<unsigned short, ll::offset::BLOCKAPI_getTileData>(this);
|
||||
auto blk = &getLegacyBlock();
|
||||
|
||||
if (((BlockLegacy*)blk)->toBlock(tileData) == (Block*)this) {
|
||||
@ -64,5 +64,5 @@ bool Block::setNbt(CompoundTag* nbt) {
|
||||
|
||||
unsigned int const & Block::getRuntimeId() const{
|
||||
// Actor::_playFlySound Line7
|
||||
return dAccess<unsigned int>(this, 48);
|
||||
return dAccess<unsigned int>(this, ll::offset::BLOCKAPI_getRuntimeId);
|
||||
}
|
@ -13,7 +13,7 @@ Block* BlockLegacy::toBlock(unsigned short tileData) {
|
||||
}
|
||||
|
||||
string BlockLegacy::getTypeName() {
|
||||
return dAccess<string, 128>(this);
|
||||
return dAccess<string, ll::offset::BLOCKLEGACYAPI_getRuntimeId>(this);
|
||||
}
|
||||
|
||||
bool BlockLegacy::applyBoneMeal(BlockSource* a1, BlockPos* a2) {
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <llapi/HookAPI.h>
|
||||
|
||||
LIAPI std::string Container::getTypeName() {
|
||||
ContainerType type = dAccess<ContainerType>(this, 8); //IDA Container::Container
|
||||
ContainerType type = dAccess<ContainerType>(this, ll::offset::CONTAINERAPI_getTypeName); //IDA Container::Container
|
||||
// ContainerType type = getContainerType();
|
||||
return std::string{magic_enum::enum_name(type)};
|
||||
}
|
||||
|
@ -3,5 +3,5 @@
|
||||
#include <llapi/HookAPI.h>
|
||||
|
||||
ServerPlayer* GameMode::getPlayer() {
|
||||
return dAccess<ServerPlayer*, 8>(this);
|
||||
return dAccess<ServerPlayer*, ll::offset::GAMEMODEAPI_getPlayer>(this);
|
||||
}
|
@ -2,13 +2,13 @@
|
||||
#include <llapi/HookAPI.h>
|
||||
|
||||
FaceID HitResult::getFacing() {
|
||||
return dAccess<FaceID>(this, 28);
|
||||
return dAccess<FaceID>(this, ll::offset::HITRESULTAPI_getFacing);
|
||||
}
|
||||
Vec3 HitResult::getPos() {
|
||||
return dAccess<Vec3>(this, 44);
|
||||
return dAccess<Vec3>(this, ll::offset::HITRESULTAPI_getPos);
|
||||
}
|
||||
bool HitResult::isHitLiquid() {
|
||||
return dAccess<bool>(this, 80);
|
||||
return dAccess<bool>(this, ll::offset::HITRESULTAPI_isHitLiquid);
|
||||
}
|
||||
// LIAPI bool HitResult::isEntity() {
|
||||
// return getHitResultType() == HitResultType::ENTITY;
|
||||
@ -17,13 +17,13 @@ bool HitResult::isHitLiquid() {
|
||||
// return getHitResultType() == HitResultType::TILE;
|
||||
// }
|
||||
BlockPos HitResult::getBlockPos() {
|
||||
return dAccess<BlockPos>(this, 32);
|
||||
return dAccess<BlockPos>(this, ll::offset::HITRESULTAPI_getBlockPos);
|
||||
}
|
||||
BlockPos HitResult::getLiquidPos() {
|
||||
return dAccess<BlockPos>(this, 84);
|
||||
return dAccess<BlockPos>(this, ll::offset::HITRESULTAPI_getLiquidPos);
|
||||
}
|
||||
FaceID HitResult::getLiquidFacing() {
|
||||
return dAccess<FaceID>(this, 81);
|
||||
return dAccess<FaceID>(this, ll::offset::HITRESULTAPI_getLiquidFacing);
|
||||
}
|
||||
// LIAPI Vec3 HitResult::getLiquidHitPos();
|
||||
// LIAPI HitResultType HitResult::getHitResultType() {
|
||||
|
@ -3,18 +3,18 @@
|
||||
#include <llapi/HookAPI.h>
|
||||
|
||||
ItemStack* ItemActor::getItemStack() {
|
||||
return (ItemStack*)((uintptr_t)this + 1568); // IDA Player::take Line127
|
||||
return dAccess<ItemStack*>(this, ll::offset::ITEMACTORAPI_getItemStack); // IDA Player::take Line127
|
||||
}
|
||||
|
||||
int ItemActor::getDespawnTime() {
|
||||
return dAccess<int, 433*4>(this); // ItemActor::NormalTick Line258
|
||||
return dAccess<int, ll::offset::ITEMACTORAPI_getDespawnTime>(this); // ItemActor::NormalTick Line258
|
||||
}
|
||||
|
||||
bool ItemActor::setDespawnTime(int a1) {
|
||||
dAccess<int, 433*4>(this) = a1;
|
||||
dAccess<int, ll::offset::ITEMACTORAPI_getDespawnTime>(this) = a1;
|
||||
return true;
|
||||
}
|
||||
|
||||
int ItemActor::getLatestSpawnTime() {
|
||||
return dAccess<int, 428*4>(this);
|
||||
return dAccess<int, ll::offset::ITEMACTORAPI_getLatestSpawnTime>(this);
|
||||
}
|
@ -84,7 +84,7 @@ int ItemStack::getAux() const {
|
||||
int ItemStack::getCount() const {
|
||||
if (this->isNull())
|
||||
return 0;
|
||||
return dAccess<unsigned char, 34>(this);
|
||||
return dAccess<unsigned char, ll::offset::ITEMSTACKAPI_getCount>(this);
|
||||
}
|
||||
|
||||
bool ItemStack::setItem(ItemStack* newItem) {
|
||||
@ -112,7 +112,7 @@ bool ItemStack::setNbt(CompoundTag* nbt) {
|
||||
int ItemStackBase::getCount() const {
|
||||
if (this->isNull())
|
||||
return 0;
|
||||
return dAccess<unsigned char, 34>(this);
|
||||
return dAccess<unsigned char, ll::offset::ITEMSTACKAPI_getCount>(this);
|
||||
}
|
||||
|
||||
// string ItemStack::getStandardName(const Localization& language) {
|
||||
|
@ -65,7 +65,7 @@ Block* Level::getBlock(const BlockPos& pos, BlockSource* blockSource) {
|
||||
|
||||
BlockPalette* Level::getBlockPalettePtr(){
|
||||
// MovingBlockActor::load Line69
|
||||
return dAccess<BlockPalette*>(Global<Level>,2000);
|
||||
return dAccess<BlockPalette*>(Global<Level>,ll::offset::LEVELAPI_getBlockPalettePtr);
|
||||
};
|
||||
|
||||
// Return nullptr when failing to get block
|
||||
|
@ -47,13 +47,13 @@ extern Logger logger;
|
||||
|
||||
NetworkIdentifier* Player::getNetworkIdentifier() const{
|
||||
//ServerPlayer::isHostingPlayer
|
||||
return dAccess<NetworkIdentifier*>(this, 2432);
|
||||
return dAccess<NetworkIdentifier*>(this, ll::offset::PLAYERAPI_getNetworkIdentifier);
|
||||
}
|
||||
|
||||
|
||||
Certificate* Player::getCertificate() const{
|
||||
//KickCommand::_kickPlayer Line116
|
||||
return dAccess<Certificate*>(this, 2736);
|
||||
return dAccess<Certificate*>(this, ll::offset::PLAYERAPI_getCertificate);
|
||||
}
|
||||
|
||||
std::string Player::getRealName() {
|
||||
@ -99,12 +99,12 @@ string Player::getServerAddress() {
|
||||
|
||||
int Player::getPlatform(){
|
||||
//AddPlayerPacket::AddPlayerPacket Line59
|
||||
return dAccess<int>(this, 2104);
|
||||
return dAccess<int>(this, ll::offset::PLAYERAPI_getPlatform);
|
||||
}
|
||||
|
||||
Container & Player::getInventory(){
|
||||
//InventoryContainerModel::_getContainer 2928 + 176
|
||||
return dAccess<Container>(this, 3104);
|
||||
return dAccess<Container>(this, ll::offset::PLAYERAPI_getInventory);
|
||||
}
|
||||
|
||||
enum CommandPermissionLevel Player::getPlayerPermissionLevel(){
|
||||
@ -258,12 +258,12 @@ bool Player::transferServer(const string& address, unsigned short port) {
|
||||
|
||||
BlockPos const & Player::getSpawnPosition(){
|
||||
//ServerNetworkHandler::_sendLevelData Line316
|
||||
return dAccess<BlockPos>(this, 1797*4);
|
||||
return dAccess<BlockPos>(this, ll::offset::PLAYERAPI_getSpawnPosition);
|
||||
}
|
||||
|
||||
AutomaticID<Dimension, int> Player::getSpawnDimension(){
|
||||
//ServerNetworkHandler::_sendLevelData Line310
|
||||
return dAccess<AutomaticID<Dimension, int>>(this, 1800*4);
|
||||
return dAccess<AutomaticID<Dimension, int>>(this, ll::offset::PLAYERAPI_getSpawnDimension);
|
||||
}
|
||||
|
||||
std::pair<BlockPos, int> Player::getRespawnPosition() {
|
||||
@ -322,12 +322,12 @@ string Player::getXuid() const{
|
||||
}
|
||||
|
||||
mce::UUID Player::getClientUUID()const{
|
||||
return dAccess<mce::UUID>(this,2720);
|
||||
return dAccess<mce::UUID>(this,ll::offset::PLAYERAPI_getClientUUID);
|
||||
};
|
||||
|
||||
unsigned char Player::getClientSubId() {
|
||||
//ServerPlayer::sendNetworkPacket 参4
|
||||
return dAccess<unsigned char>(this,3520);
|
||||
return dAccess<unsigned char>(this,ll::offset::PLAYERAPI_getClientSubId);
|
||||
}
|
||||
|
||||
float Player::getAvgPacketLoss() {
|
||||
@ -442,7 +442,7 @@ size_t Player::getTotalXpNeededForLevel(int level) {
|
||||
|
||||
bool Player::crashClient() {
|
||||
auto pkt = MinecraftPackets::createPacket(MinecraftPacketIds::LevelChunk);
|
||||
dAccess<bool, 56>(pkt.get()) = 1;
|
||||
dAccess<bool, ll::offset::PLAYERAPI_crashClient>(pkt.get()) = 1;
|
||||
sendNetworkPacket(*pkt);
|
||||
return true;
|
||||
}
|
||||
@ -684,8 +684,8 @@ bool Player::sendUpdateBlockPacket(BlockPos const& bpos, const Block& block, Upd
|
||||
|
||||
bool Player::sendTransferPacket(const string& address, short port) const {
|
||||
auto packet = MinecraftPackets::createPacket(0x55);
|
||||
dAccess<short>(packet.get(), 36) = port;
|
||||
dAccess<string>(packet.get(), 40) = address;
|
||||
dAccess<short>(packet.get(), ll::offset::PLAYERAPI_sendTransferPacket_port) = port;
|
||||
dAccess<string>(packet.get(), ll::offset::PLAYERAPI_sendTransferPacket_address) = address;
|
||||
sendNetworkPacket(*packet);
|
||||
return true;
|
||||
}
|
||||
@ -698,8 +698,8 @@ bool Player::sendSetDisplayObjectivePacket(const string& title, const string& na
|
||||
|
||||
bool Player::sendSetScorePacket(char type, const vector<ScorePacketInfo>& data) {
|
||||
auto packet = MinecraftPackets::createPacket(0x6c);
|
||||
dAccess<char>(packet.get(), 48) = type;
|
||||
dAccess<vector<ScorePacketInfo>>(packet.get(), 56) = data;
|
||||
dAccess<char>(packet.get(), ll::offset::PLAYERAPI_sendSetScorePacket_type) = type;
|
||||
dAccess<vector<ScorePacketInfo>>(packet.get(), ll::offset::PLAYERAPI_sendSetScorePacket_data) = data;
|
||||
sendNetworkPacket(*packet);
|
||||
return true;
|
||||
}
|
||||
@ -750,7 +750,7 @@ bool Player::sendSetScorePacket(char type, const vector<ScorePacketInfo>& data)
|
||||
|
||||
bool Player::sendCommandRequestPacket(const string& cmd) {
|
||||
auto packet = MinecraftPackets::createPacket(0x4d);
|
||||
dAccess<string, 48>(packet.get()) = cmd;
|
||||
dAccess<string, ll::offset::PLAYERAPI_sendCommandRequestPacket_cmd>(packet.get()) = cmd;
|
||||
Global<ServerNetworkHandler>->handle(*getNetworkIdentifier(), *((CommandRequestPacket*)packet.get()));
|
||||
return true;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <llapi/HookAPI.h>
|
||||
|
||||
void ResourcePackRepository::setCustomResourcePackPath(PackType type, const std::string& path) {
|
||||
auto CompositePack = dAccess<CompositePackSource*>(this, 48);
|
||||
auto CompositePack = dAccess<CompositePackSource*>(this, ll::offset::RESOURCEPACKREPOSITORYAPI_setCustomResourcePackPath);
|
||||
auto PackSourceFactory = getPackSourceFactory();
|
||||
auto& DirectoryPackSource = PackSourceFactory->createDirectoryPackSource(Core::Path(path), type, PackOrigin::PackOrigin_Dev, 0);
|
||||
CompositePack->addPackSource((PackSource*)&DirectoryPackSource);
|
||||
|
@ -142,12 +142,12 @@ void CompoundTag::setItemStack(ItemStack* item) {
|
||||
}
|
||||
|
||||
std::unique_ptr<CompoundTag> CompoundTag::fromBlock(Block* block) {
|
||||
auto tag = (CompoundTag*)((uintptr_t)block + 24); //dAccess Block::Block
|
||||
auto tag = dAccess<CompoundTag*>(block, ll::offset::COMPOUNDTAGAPI_fromBlock); //dAccess Block::Block
|
||||
return tag->clone();
|
||||
}
|
||||
|
||||
void CompoundTag::setBlock(Block* blk) {
|
||||
auto tag = (CompoundTag*)((uintptr_t)blk + 24);//dAccess Block::Block
|
||||
auto tag = dAccess<CompoundTag*>(blk, ll::offset::COMPOUNDTAGAPI_fromBlock);//dAccess Block::Block
|
||||
tag->deepCopy(*this);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user