From 2d5e6736d7f5d98412dfb91f5c05822422d4671f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=90=E6=B2=90=E5=91=80?= <163636894+zimuya4153@users.noreply.github.com> Date: Wed, 10 Jul 2024 11:06:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A03=E4=B8=AA=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - getPlayerRuntimeId - getEntityRuntimeId - getEntityNameTag --- src/CompatibilityApi.cpp | 12 ++++++++++-- src/EventAPI.cpp | 1 - 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/CompatibilityApi.cpp b/src/CompatibilityApi.cpp index df6e229..f90995a 100644 --- a/src/CompatibilityApi.cpp +++ b/src/CompatibilityApi.cpp @@ -1,5 +1,4 @@ #include "Global.h" -#include "mc/deps/core/string/HashedString.h" #include bool isInteger(const std::string& str) { @@ -732,7 +731,7 @@ void Export_Compatibility_API() { }); RemoteCall::exportAs("GMLIB_API", "getEnchantTypeNameFromId", [](int id) -> std::string { if (auto enchant = Enchant::getEnchant((Enchant::Type)id)) { - return enchant->getStringId(); + return std::string(enchant->getStringId()); } return ""; }); @@ -772,4 +771,13 @@ void Export_Compatibility_API() { "dropPlayerItem", [](Player* player, ItemStack const* item, bool randomly) -> bool { return player->drop(*item, randomly); } ); + RemoteCall::exportAs("GMLIB_API", "getPlayerRuntimeId", [](Player* player) -> uint64 { + return player->getRuntimeID().id; + }); + RemoteCall::exportAs("GMLIB_API", "getEntityRuntimeId", [](Actor* entity) -> uint64 { + return entity->getRuntimeID().id; + }); + RemoteCall::exportAs("GMLIB_API", "getEntityNameTag", [](Actor* entity) -> std::string { + return entity->getNameTag(); + }); } \ No newline at end of file diff --git a/src/EventAPI.cpp b/src/EventAPI.cpp index 1ae5c61..a9225e3 100644 --- a/src/EventAPI.cpp +++ b/src/EventAPI.cpp @@ -1,5 +1,4 @@ #include "Global.h" -#include "mc/world/ActorUniqueID.h" using namespace ll::hash_utils; void Export_Event_API() {