mirror of
https://github.com/quizhizhe/LiteLoaderBDS-1.16.40.git
synced 2025-06-01 19:53:41 +00:00
Add Level::getPlayer(mce::UUID)
This commit is contained in:
parent
71bb904d81
commit
7332bc36c7
@ -41,6 +41,7 @@ public:
|
||||
LIAPI static std::vector<Player*> getAllPlayers();
|
||||
LIAPI Player* getPlayer(const string& info); // name or xuid
|
||||
LIAPI Player* getPlayer(ActorUniqueID id); // UniqueID
|
||||
LIAPI Player* getPlayer(const mce::UUID& uuid)const; //原生函数Level::getPlayer(mce::UUID)
|
||||
LIAPI static Actor* getEntity(ActorUniqueID id);
|
||||
LIAPI static std::vector<Actor*> getAllEntities(int dimId);
|
||||
LIAPI static std::vector<Actor*> getAllEntities();
|
||||
|
@ -294,7 +294,7 @@ Player* Level::getPlayer(const string& info) {
|
||||
|
||||
Player* Level::getPlayer(ActorUniqueID id) {
|
||||
// 裂开,这个符号也没有
|
||||
//根据伪代码重新写实现
|
||||
// 根据伪代码重新写实现
|
||||
Actor* actor = Level::fetchEntity(id,0);
|
||||
if(actor && actor->hasCategory((ActorCategory)1))
|
||||
return (Player*)actor;
|
||||
@ -303,6 +303,17 @@ Player* Level::getPlayer(ActorUniqueID id) {
|
||||
//return SymCall("?getPlayer@Level@@UEBAPEAVPlayer@@UActorUniqueID@@@Z", Player*, Level*, ActorUniqueID)(Global<Level>, id);
|
||||
}
|
||||
|
||||
Player* Level::getPlayer(const mce::UUID& uuid) const{
|
||||
// 根据函数
|
||||
// std::_Func_impl_no_alloc__lambda_71cde901375eb38deb56f48a96514d77__bool_Player_const___::_Do_call
|
||||
Player* findPlayer = this->findPlayer([&](const Player& pl)->bool {
|
||||
if (pl.getClientUUID() == uuid)
|
||||
return true;
|
||||
return false;
|
||||
});
|
||||
return findPlayer;
|
||||
}
|
||||
|
||||
Actor* Level::spawnMob(Vec3 pos, int dimId, std::string name) {
|
||||
|
||||
Spawner* sp = &Global<Level>->getSpawner();
|
||||
|
Loading…
Reference in New Issue
Block a user