diff --git a/LiteLoader/Header/MC/BlockSource.hpp b/LiteLoader/Header/MC/BlockSource.hpp index 0cd2939..a47e8d6 100644 --- a/LiteLoader/Header/MC/BlockSource.hpp +++ b/LiteLoader/Header/MC/BlockSource.hpp @@ -26,7 +26,7 @@ public: Dimension* mDimension = dAccess< Dimension*>(this, 4); return dAccess>(mDimension, 192); }; - LevelChunk * getChunkAt(BlockPos& pos) const{ + LevelChunk * getChunkAt(const BlockPos& pos) const{ ChunkPos chunkPos = ChunkPos(pos.x>>4, pos.z>>4); return getChunk(chunkPos); } diff --git a/LiteLoader/Header/MC/ChunkBlockPos.hpp b/LiteLoader/Header/MC/ChunkBlockPos.hpp index 1865e8f..208e503 100644 --- a/LiteLoader/Header/MC/ChunkBlockPos.hpp +++ b/LiteLoader/Header/MC/ChunkBlockPos.hpp @@ -43,7 +43,12 @@ ChunkBlockPos(char x, short y, char z) : x(x) , y(y) , z(z){}; - +ChunkBlockPos(class BlockPos const & pos, short a2){ + ChunkBlockPos(pos.x & 16,pos.y - a2,pos.z & 16); +}; +ChunkBlockPos(unsigned char x, class ChunkLocalHeight y, unsigned char z){ + ChunkBlockPos(x, y, z); +} #undef AFTER_EXTRA #ifndef DISABLE_CONSTRUCTOR_PREVENTION_CHUNKBLOCKPOS public: @@ -57,26 +62,26 @@ public: * @symbol ??0ChunkBlockPos@@QEAA@EVChunkLocalHeight@@E@Z * @hash -1288855647 */ - MCAPI ChunkBlockPos(unsigned char, class ChunkLocalHeight, unsigned char); + //MCAPI ChunkBlockPos(unsigned char, class ChunkLocalHeight, unsigned char); /** * @symbol ??0ChunkBlockPos@@QEAA@AEBVBlockPos@@F@Z * @hash -1853558367 */ - MCAPI ChunkBlockPos(class BlockPos const &, short); + //MCAPI ChunkBlockPos(class BlockPos const &, short); /** * @symbol ?toPos@ChunkBlockPos@@QEBA?AVPos@@XZ * @hash 1137411744 */ - MCAPI class Pos toPos() const; + //MCAPI class Pos toPos() const; /** * @symbol ?from2D@ChunkBlockPos@@SA?AV1@EE@Z * @hash 2007391019 */ - MCAPI static class ChunkBlockPos from2D(unsigned char, unsigned char); + //MCAPI static class ChunkBlockPos from2D(unsigned char, unsigned char); /** * @symbol ?fromLegacyIndex@ChunkBlockPos@@SA?AV1@G@Z * @hash -1358394925 */ - MCAPI static class ChunkBlockPos fromLegacyIndex(unsigned short); + //MCAPI static class ChunkBlockPos fromLegacyIndex(unsigned short); }; \ No newline at end of file diff --git a/LiteLoader/Header/MC/CommandUtils.hpp b/LiteLoader/Header/MC/CommandUtils.hpp index 30a81e7..9548443 100644 --- a/LiteLoader/Header/MC/CommandUtils.hpp +++ b/LiteLoader/Header/MC/CommandUtils.hpp @@ -12,12 +12,11 @@ namespace CommandUtils { #define AFTER_EXTRA -// std::string getActorName(Actor &actor,int a1) { -// //a1是没啥用的,只是为了改变符号 -// std::string (*rv)(Actor &); -// *((void**)&rv) = dlsym("?getEntityName@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBVActor@@@Z"); -// return (*rv)(actor); -// } + inline std::string getActorName(class Actor const &actor) { + std::string (*rv)(class Actor const &); + *((void**)&rv) = dlsym("?getEntityName@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBVActor@@@Z"); + return (*rv)(actor); + } #undef AFTER_EXTRA MCAPI extern std::vector> const CMD_INPUT_UNICODE_TRANSLATE_MAP; MCAPI bool addItemInstanceComponents(class ItemInstance &, class Json::Value const &, std::string &); diff --git a/LiteLoader/Header/MC/Dimension.hpp b/LiteLoader/Header/MC/Dimension.hpp index 5ed6d2b..a1b8d5b 100644 --- a/LiteLoader/Header/MC/Dimension.hpp +++ b/LiteLoader/Header/MC/Dimension.hpp @@ -12,8 +12,12 @@ class Dimension { #define AFTER_EXTRA public: BlockSource& getBlockSourceFromMainChunkSource() const{ - return *dAccess(this, 96); + //ExplorationMapFunction::apply Line57 + return *dAccess(this, 72); }; + int getHeight(){ + return dAccess(this,202); + } #undef AFTER_EXTRA #ifndef DISABLE_CONSTRUCTOR_PREVENTION_DIMENSION public: diff --git a/LiteLoader/Kernel/Command/DynamicCommandAPI.cpp b/LiteLoader/Kernel/Command/DynamicCommandAPI.cpp index a0370c3..85a33f5 100644 --- a/LiteLoader/Kernel/Command/DynamicCommandAPI.cpp +++ b/LiteLoader/Kernel/Command/DynamicCommandAPI.cpp @@ -332,8 +332,7 @@ for (auto& actor : actors) { if (!first) oss << ", "; - oss << actor->getNameTag(); - //oss << CommandUtils::getActorName(*actor,1); + oss << CommandUtils::getActorName(*actor); } oss << "]"; return fmt::format("name: {:15s}, type: {:15s}, isSet: {:5}, value: {}", name, typeName, isSet, oss.str()); diff --git a/LiteLoader/Kernel/EventAPI.cpp b/LiteLoader/Kernel/EventAPI.cpp index 36f3194..6dd1055 100644 --- a/LiteLoader/Kernel/EventAPI.cpp +++ b/LiteLoader/Kernel/EventAPI.cpp @@ -323,6 +323,7 @@ TClasslessInstanceHook(void, "?sendLoginMessageLocal@ServerNetworkHandler@@QEAAX /////////////////// PlayerJoin /////////////////// TInstanceHook(bool, "?onReady_ClientGeneration@ServerNetworkHandler@@QEAAXAEAVPlayer@@AEBVNetworkIdentifier@@@Z", ServerNetworkHandler,Player* player,NetworkIdentifier *net) { + //std::cout<<"PlayerJoin"<