From 9440b261de016fe4362c625c30e97d861a76cbb1 Mon Sep 17 00:00:00 2001 From: Qiuzhizhe <42761326+quizhizhe@users.noreply.github.com> Date: Fri, 28 Oct 2022 11:12:26 -0700 Subject: [PATCH] Fix Actor::getTypeName --- LiteLoader/Kernel/MC/ActorAPI.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/LiteLoader/Kernel/MC/ActorAPI.cpp b/LiteLoader/Kernel/MC/ActorAPI.cpp index 966cc37..1c51427 100644 --- a/LiteLoader/Kernel/MC/ActorAPI.cpp +++ b/LiteLoader/Kernel/MC/ActorAPI.cpp @@ -60,7 +60,12 @@ bool Actor::isOnGround() const { } std::string Actor::getTypeName() const { - return getActorIdentifier().getCanonicalName(); +// return getActorIdentifier().getCanonicalName(); + //以下根据EntityTypeToLocString的逻辑写的 + int actorTypeId = this->getEntityTypeId(); + //以下函数原型std::string EntityTypeToString(int actorTypeId,int rules) + return SymCall("?EntityTypeToString@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@W4ActorType@@W4ActorTypeNamespaceRules@@@Z", + std::string, int, int)(actorTypeId,0); } bool Actor::hurtEntity(float damage,ActorDamageCause damageCause) {