feat:adapt to levilamina 1.9.x

This commit is contained in:
n15421
2026-02-03 21:00:22 +08:00
Unverified
parent 1f664c211a
commit 08bdd2c335
2 changed files with 13 additions and 11 deletions
+7 -6
View File
@@ -1,4 +1,5 @@
#include "Global.h" #include "Global.h"
#include "gmlib/mc/world/actor/Player.h"
#include "mc/platform/UUID.h" #include "mc/platform/UUID.h"
#include <regex> #include <regex>
@@ -503,7 +504,7 @@ void Export_Compatibility_API() {
return ""; return "";
}); });
RemoteCall::exportAs("GMLIB_API", "getXuidByName", [](std::string const& name) -> std::string { RemoteCall::exportAs("GMLIB_API", "getXuidByName", [](std::string const& name) -> std::string {
if (auto uce = UserCache::getInstance()->from(name, UserCache::QueryType::Name)) { if (auto uce = UserCache::getInstance()->from(name, UserCache::Name)) {
return uce->mXuid; return uce->mXuid;
} }
return ""; return "";
@@ -515,19 +516,19 @@ void Export_Compatibility_API() {
return ""; return "";
}); });
RemoteCall::exportAs("GMLIB_API", "getNameByXuid", [](std::string const& xuid) -> std::string { RemoteCall::exportAs("GMLIB_API", "getNameByXuid", [](std::string const& xuid) -> std::string {
if (auto uce = UserCache::getInstance()->from(xuid, UserCache::QueryType::Xuid)) { if (auto uce = UserCache::getInstance()->from(xuid, UserCache::Xuid)) {
return uce->mName; return uce->mName;
} }
return ""; return "";
}); });
RemoteCall::exportAs("GMLIB_API", "getUuidByXuid", [](std::string const& xuid) -> std::string { RemoteCall::exportAs("GMLIB_API", "getUuidByXuid", [](std::string const& xuid) -> std::string {
if (auto uce = UserCache::getInstance()->from(xuid, UserCache::QueryType::Xuid)) { if (auto uce = UserCache::getInstance()->from(xuid, UserCache::Xuid)) {
return uce->mUuid.asString(); return uce->mUuid.asString();
} }
return ""; return "";
}); });
RemoteCall::exportAs("GMLIB_API", "getUuidByName", [](std::string const& name) -> std::string { RemoteCall::exportAs("GMLIB_API", "getUuidByName", [](std::string const& name) -> std::string {
if (auto uce = UserCache::getInstance()->from(name, UserCache::QueryType::Name)) { if (auto uce = UserCache::getInstance()->from(name, UserCache::Name)) {
return uce->mUuid.asString(); return uce->mUuid.asString();
} }
return ""; return "";
@@ -552,7 +553,7 @@ void Export_Compatibility_API() {
return result; return result;
} }
} }
if (auto uce = UserCache::getInstance()->from(info, UserCache::QueryType::Default)) { if (auto uce = UserCache::getInstance()->from(info, UserCache::Default)) {
ll::reflection::forEachMember(*uce, [&](std::string_view name, auto&& member) { ll::reflection::forEachMember(*uce, [&](std::string_view name, auto&& member) {
result[std::string{name.substr(1)}] = fmt::to_string(member); result[std::string{name.substr(1)}] = fmt::to_string(member);
}); });
@@ -823,7 +824,7 @@ void Export_Compatibility_API() {
} }
); );
RemoteCall::exportAs("GMLIB_API", "getPlayerHungry", [](Player* player) -> float { RemoteCall::exportAs("GMLIB_API", "getPlayerHungry", [](Player* player) -> float {
return player->getMutableAttribute(Player::HUNGER()).mInstance->mCurrentValue; return player->getAttribute(Player::HUNGER()).mPtr->mCurrentValue;
}); });
RemoteCall::exportAs("GMLIB_API", "getPlayerArmorCoverPercentage", [](Player* player) -> float { RemoteCall::exportAs("GMLIB_API", "getPlayerArmorCoverPercentage", [](Player* player) -> float {
return player->getArmorCoverPercentage(); return player->getArmorCoverPercentage();
+6 -5
View File
@@ -8,12 +8,12 @@ if not has_config("vs_runtime") then
set_runtimes("MD") set_runtimes("MD")
end end
add_requires("levilamina 1.7.3", {configs = {target_type = "server"}}) add_requires("levilamina 050b392575227db10340075328e833c1a0f41e27", {configs = {target_type = "server"}})
add_requires("legacyremotecall") add_requires("legacyremotecall")
add_requires("levibuildscript 0.5.2") add_requires("levibuildscript 0.6.0")
add_requires("ilistenattentively 0.10.0") add_requires("ilistenattentively 0.11.0")
add_requires("gmlib 1.7.0") add_requires("gmlib 1.9.0")
add_requires("modapi 0.3.0") add_requires("modapi 0.4.0")
target("GMLIB-LegacyRemoteCallApi") target("GMLIB-LegacyRemoteCallApi")
add_cxflags( add_cxflags(
@@ -26,6 +26,7 @@ target("GMLIB-LegacyRemoteCallApi")
"UNICODE", "UNICODE",
"_HAS_CXX23=1" "_HAS_CXX23=1"
) )
add_defines("LL_PLAT_S") --TODO: check client compatibility
add_files( add_files(
"src/**.cpp" "src/**.cpp"
) )