From 08b1967cc393fb467458e8f220da20ca630c2988 Mon Sep 17 00:00:00 2001 From: Qiuzhizhe <42761326+quizhizhe@users.noreply.github.com> Date: Thu, 17 Nov 2022 14:34:27 +0800 Subject: [PATCH] Add Player::getClientUUID --- LiteLoader/Header/MC/Player.hpp | 6 +++++- LiteLoader/Kernel/MC/PlayerAPI.cpp | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/LiteLoader/Header/MC/Player.hpp b/LiteLoader/Header/MC/Player.hpp index fee59af..4293961 100644 --- a/LiteLoader/Header/MC/Player.hpp +++ b/LiteLoader/Header/MC/Player.hpp @@ -24,6 +24,9 @@ class Player : public Mob { #define AFTER_EXTRA // Add new members to class + // mClientUUID 2720 + // mCertificate 2736 + // mClientSubId 3520 public: enum PositionMode : char { NORMAL, @@ -34,8 +37,9 @@ public: LIAPI std::string getName(); LIAPI std::string getRealName(); - LIAPI std::string getUuid(); + LIAPI std::string getUuid()const; LIAPI std::string getXuid()const; + LIAPI mce::UUID getClientUUID()const; LIAPI unsigned char getClientSubId(); LIAPI string getDeviceTypeName(); LIAPI int getAvgPing(); diff --git a/LiteLoader/Kernel/MC/PlayerAPI.cpp b/LiteLoader/Kernel/MC/PlayerAPI.cpp index 4f55f66..0cc27cf 100644 --- a/LiteLoader/Kernel/MC/PlayerAPI.cpp +++ b/LiteLoader/Kernel/MC/PlayerAPI.cpp @@ -311,7 +311,7 @@ bool Player::refreshAttributes(std::vector const& attributes) return true; } -string Player::getUuid() { +string Player::getUuid() const{ auto result = ExtendedCertificate::getIdentity(*getCertificate()); return result.asString(); } @@ -320,6 +320,10 @@ string Player::getXuid() const{ return ExtendedCertificate::getXuid(*getCertificate()); } +mce::UUID Player::getClientUUID()const{ + return dAccess(this,2720); +}; + unsigned char Player::getClientSubId() { //ServerPlayer::sendNetworkPacket 参4 return dAccess(this,3520);