Skip to content

Commit

Permalink
support 1.17.40.6
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaohengying committed Nov 6, 2021
1 parent ffe504c commit 4faeb77
Show file tree
Hide file tree
Showing 5 changed files with 427 additions and 345 deletions.
16 changes: 15 additions & 1 deletion api/entity/Actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@

namespace trapdoor {

namespace {
void *getUserEntityIdentifierComponent(trapdoor::Actor *actor) {
if (!actor) return nullptr;
return SYM_CALL(
void *(*)(trapdoor::Actor *),
SymHook::
Actor_tryGetComponent_UserEntityIdentifierComponent_4bafed89,
actor);
}
} // namespace

using namespace SymHook;

uint64_t NetworkIdentifier::getHash() {
Expand Down Expand Up @@ -67,8 +78,11 @@ namespace trapdoor {
}

NetworkIdentifier *Actor::getClientID() {
return reinterpret_cast<NetworkIdentifier *>(
getUserEntityIdentifierComponent(this));
//! from ServerPlayer::isHostingPlayer
return offset_cast<NetworkIdentifier *>(this, off::ACTOR_GET_CLIENT_ID);
// return offset_cast<NetworkIdentifier *>(this,
// off::ACTOR_GET_CLIENT_ID);
}

PlayerPermissionLevel Actor::getCommandLevel() {
Expand Down
1 change: 1 addition & 0 deletions api/entity/Actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ namespace trapdoor {

//设置头顶的tag
void setNameTag(const std::string &name);

};

/**
Expand Down
Loading

0 comments on commit 4faeb77

Please sign in to comment.