diff --git a/lib/EventAPI-JS.js b/lib/EventAPI-JS.js index 408e12c..06cf8b9 100644 --- a/lib/EventAPI-JS.js +++ b/lib/EventAPI-JS.js @@ -2,13 +2,50 @@ * @returns {string} */ const getPluginName = () => { + // quickjs try { throw new Error("getPluginName"); } catch (error) { - return error.stack.trim().match(/plugins\\(.*)\\.*\.js:[0-9]+\)$/i)?.[1] - || error.stack.trim().match(/at \(([^\\|/]+)(.*?):\d+:\d+\)$/i)?.[1] - || "Unknown"; + const /** @type {string} */ line = error.stack.trim().split("\n").pop().trim(); + if (line.includes("")) { + return line.slice( + line.indexOf("(") + 1, + line.indexOf("\\") + ); + } + if (line.includes("")) { + return line.slice( + line.indexOf("/", line.indexOf("/") + 1) + 1, + line.indexOf("\\") + ); + } } + + // nodejs + try { + const path = require('path'); + const selfFileName = path.basename(__filename); + const pluginDirectory = Object.entries( + require('module')._pathCache + ).find( + ([key, _]) => + key.includes(selfFileName) + )[0].split("\u0000")[1]; + const directories = pluginDirectory.split("\\"); + const pluginName = directories[directories.findIndex(value => value === "plugins") + 1].trim(); + if (pluginName) return pluginName; + } catch { } + try { + throw new Error("getPluginName"); + } catch (error) { + const /** @type {string} */ line = error.stack.trim().split("\n").pop().trim(); + if (line.includes(".js") && /:\d+:\d+$/.test(line)) { + const directories = line.split("\\"); + const pluginName = directories[directories.findIndex(value => value === "plugins") + 1].trim(); + if (pluginName) return pluginName; + } + } + return "Unknown"; }; module.exports = { diff --git a/lib/GMLIB_API-JS.js b/lib/GMLIB_API-JS.js index cd48ed4..a6c352c 100644 --- a/lib/GMLIB_API-JS.js +++ b/lib/GMLIB_API-JS.js @@ -256,7 +256,7 @@ const GMLIB_API = { blockPlayerWillDestroy: ll.import("GMLIB_API", "blockPlayerWillDestroy"), /** 使玩家攻击实体 @type {function(Entity,Player):boolean} */ playerAttack: ll.import("GMLIB_API", "playerAttack"), - /** @type {function(Player,Entity):boolean} */ + /** @type {function(Player,Entity):void} */ playerPullInEntity: ll.import("GMLIB_API", "playerPullInEntity"), /** 根据命令空间获取翻译键名 @type {function(string):string} */ getBlockTranslateKeyFromName: ll.import("GMLIB_API", "getBlockTranslateKeyFromName"), @@ -2739,10 +2739,9 @@ LLSE_Player.prototype.pullInEntity = /** * * @param {Entity} entity 实体对象 - * @returns {boolean} */ function (entity) { - return GMLIB_API.playerPullInEntity(this, entity); + GMLIB_API.playerPullInEntity(this, entity); }; LLSE_Item.prototype.applyEnchant = diff --git a/lib/PlaceholderAPI.js b/lib/PlaceholderAPI.js index 350cce4..c594eb0 100644 --- a/lib/PlaceholderAPI.js +++ b/lib/PlaceholderAPI.js @@ -1,13 +1,50 @@ /// const getPluginName = () => { + // quickjs try { throw new Error("getPluginName"); } catch (error) { - return error.stack.trim().match(/plugins\\(.*)\\.*\.js:[0-9]+\)$/i)?.[1] - || error.stack.trim().match(/at \(([^\\|/]+)(.*?):\d+:\d+\)$/i)?.[1] - || "Unknown"; + const /** @type {string} */ line = error.stack.trim().split("\n").pop().trim(); + if (line.includes("")) { + return line.slice( + line.indexOf("(") + 1, + line.indexOf("\\") + ); + } + if (line.includes("")) { + return line.slice( + line.indexOf("/", line.indexOf("/") + 1) + 1, + line.indexOf("\\") + ); + } } + + // nodejs + try { + const path = require('path'); + const selfFileName = path.basename(__filename); + const pluginDirectory = Object.entries( + require('module')._pathCache + ).find( + ([key, _]) => + key.includes(selfFileName) + )[0].split("\u0000")[1]; + const directories = pluginDirectory.split("\\"); + const pluginName = directories[directories.findIndex(value => value === "plugins") + 1].trim(); + if (pluginName) return pluginName; + } catch { } + try { + throw new Error("getPluginName"); + } catch (error) { + const /** @type {string} */ line = error.stack.trim().split("\n").pop().trim(); + if (line.includes(".js") && /:\d+:\d+$/.test(line)) { + const directories = line.split("\\"); + const pluginName = directories[directories.findIndex(value => value === "plugins") + 1].trim(); + if (pluginName) return pluginName; + } + } + return "Unknown"; }; Function.prototype.getName = diff --git a/src/CompatibilityApi.cpp b/src/CompatibilityApi.cpp index b18080a..cd2bc3d 100644 --- a/src/CompatibilityApi.cpp +++ b/src/CompatibilityApi.cpp @@ -1,17 +1,17 @@ #include "Global.h" #include +#include ActorUniqueID parseScriptUniqueID(std::string const& uniqueId) { - return StringUtils::isInteger(uniqueId) ? ActorUniqueID(std::stoll(uniqueId)) : ActorUniqueID::INVALID_ID(); + return string_utils::isInteger(uniqueId) ? ActorUniqueID(std::stoll(uniqueId)) : ActorUniqueID::INVALID_ID(); } void Export_Compatibility_API() { RemoteCall::exportAs("GMLIB_API", "unregisterRecipe", [](std::string const& id) -> bool { - // return GMLevel::getInstance().has_value() ? GMLIB::Mod::CustomRecipe::unregisterRecipe(id) : false; - throw std::runtime_error("GMLIB_API::unregisterRecipe is not implemented"); + return CustomRecipeRegistry::getInstance().unregisterRecipe(id, true); }); RemoteCall::exportAs("GMLIB_API", "setCustomPackPath", [](std::string const& path) -> void { - AddonsLoaderUtils::addCustomPackPath(path); + AddonsLoader::addCustomPackPath(path); }); RemoteCall::exportAs("GMLIB_API", "getServerMspt", []() -> double { return GMLevel::getInstance().transform( @@ -66,20 +66,21 @@ void Export_Compatibility_API() { return OfflinePlayer::deletePlayerNbt(mce::UUID::fromString(uuid)); }); RemoteCall::exportAs("GMLIB_API", "getAllExperiments", []() -> std::vector { - // std::vector result; - // for (auto& key : GMLevel::getAllExperiments()) { - // result.push_back((int)key); - // } - // return result; - throw std::runtime_error("GMLIB_API::getAllExperiments is not implemented"); + return {36, 45, 38, 48, 47, 53, 56, 45, 40}; }); RemoteCall::exportAs("GMLIB_API", "getExperimentTranslateKey", [](int id) -> std::string { - // std::string result; - // try { - // result = Experiments::getExperimentTextID(AllExperiments(id)); - // } catch (...) {} - // return result; - throw std::runtime_error("GMLIB_API::getExperimentTranslateKey is not implemented"); + static std::unordered_map mMap = { + {36, "createWorldScreen.experimentalbiomes" }, + {45, "createWorldScreen.experimentalCreatorFeatures" }, + {38, "createWorldScreen.experimentalGameTest" }, + {48, "createWorldScreen.experimentalThirdPersonCameras" }, + {47, "createWorldScreen.experimentalFocusTargetCamera" }, + {53, "createWorldScreen.experimentalVillagerTradesRebalance" }, + {56, "createWorldScreen.experimentalDataDrivenJigsawStructures"}, + {45, "createWorldScreen.experimentalCameraAimAssist" }, + {40, "createWorldScreen.experimentalY2025Drop1" } + }; + return mMap.contains(id) ? mMap[id] : ""; }); RemoteCall::exportAs( "GMLIB_API", @@ -213,8 +214,10 @@ void Export_Compatibility_API() { "GMLIB_API", "setPlayerPosition", [](std::string const& uuid, std::pair pos) -> bool { - // return GMPlayer::setPlayerPosition(mce::UUID::fromString(uuid), pos.first, pos.second); - throw std::runtime_error("GMLIB_API::setPlayerPosition is not implemented"); + if (auto player = OfflinePlayer::getOfflinePlayer(mce::UUID::fromString(uuid))) { + return player->setPosition(pos.first, pos.second); + } + return false; } ); RemoteCall::exportAs("GMLIB_API", "playerHasScore", [](std::string const& uuid, std::string const& obj) -> bool { @@ -452,17 +455,14 @@ void Export_Compatibility_API() { return true; }); RemoteCall::exportAs("GMLIB_API", "getPlayerSpawnPoint", [](Player* pl) -> std::pair { - // auto res = ((GMPlayer*)pl)->getSpawnPoint(); - // return {res.first, res.second}; - throw std::runtime_error("GMLIB_API::getPlayerSpawnPoint is not implemented"); + return {pl->mPlayerRespawnPoint->mSpawnBlockPos, pl->mPlayerRespawnPoint->mDimension.get()}; }); RemoteCall::exportAs("GMLIB_API", "setPlayerSpawnPoint", [](Player* pl, std::pair pos) -> void { - // ((GMPlayer*)pl)->setSpawnPoint(pos.first, pos.second); - throw std::runtime_error("GMLIB_API::setPlayerSpawnPoint is not implemented"); + pl->setRespawnPosition(pos.first, pos.second); }); RemoteCall::exportAs("GMLIB_API", "clearPlayerSpawnPoint", [](Player* pl) -> void { - // ((GMPlayer*)pl)->clearSpawnPoint(); - throw std::runtime_error("GMLIB_API::clearPlayerSpawnPoint is not implemented"); + pl->mPlayerRespawnPoint->mSpawnBlockPos = BlockPos::MIN(); + pl->mPlayerRespawnPoint->mDimension = VanillaDimensions::Undefined(); }); RemoteCall::exportAs( "GMLIB_API", @@ -546,8 +546,7 @@ void Export_Compatibility_API() { return block->mDirectData->mUnkc08fbd.as(); }); RemoteCall::exportAs("GMLIB_API", "getDestroyBlockSpeed", [](ItemStack const* item, Block const* block) -> float { - // return item->getDestroySpeed(*block); - throw std::runtime_error("GMLIB_API::getDestroyBlockSpeed is not implemented"); + return item->getItem()->getDestroySpeed(*item, *block); }); RemoteCall::exportAs( "GMLIB_API", @@ -568,8 +567,7 @@ void Export_Compatibility_API() { return false; }); RemoteCall::exportAs("GMLIB_API", "itemCanDestroySpecial", [](ItemStack const* item, Block const* block) -> bool { - // return item->canDestroySpecial(*block); - throw std::runtime_error("GMLIB_API::itemCanDestroySpecial is not implemented"); + return item->getItem()->canDestroySpecial(*block); }); RemoteCall::exportAs("GMLIB_API", "blockCanDropWithAnyTool", [](Block const* block) -> bool { return !block->getLegacyBlock().mRequiresCorrectToolForDrops; @@ -584,9 +582,10 @@ void Export_Compatibility_API() { RemoteCall::exportAs("GMLIB_API", "playerAttack", [](Player* player, Actor* entity) -> bool { return player->attack(*entity, SharedTypes::Legacy::ActorDamageCause::EntityAttack); }); - RemoteCall::exportAs("GMLIB_API", "playerPullInEntity", [](Player* player, Actor* entity) -> bool { - // return player->pullInEntity(*entity); - throw std::runtime_error("GMLIB_API::playerPullInEntity is not implemented"); + RemoteCall::exportAs("GMLIB_API", "playerPullInEntity", [](Player* player, Actor* entity) -> void { + if (auto component = player->getEntityContext().tryGetComponent()){ + component->pullInEntity(*player, *entity); + } }); RemoteCall::exportAs("GMLIB_API", "getBlockTranslateKeyFromName", [](std::string const& blockName) -> std::string { return Block::tryGetFromRegistry(blockName) @@ -896,20 +895,16 @@ void Export_Compatibility_API() { "GMLIB_API", "registerCustomShapelessRecipe", [](std::string const& recipe_id, std::vector ingredients, ItemStack* result) -> void { - // if (!GMLevel::getInstance().has_value()) return; - // std::vector types; - // char rt = 'A'; - // for (auto& ing : ingredients) { - // auto ingredient = RecipeIngredient{ing, 0,1}; - // types.push_back(Recipes::Type{ - // (Item*)ingredient.getItem(), - // ingredient.getBlock(), - // ingredient, - // rt++ - // }); - // } - // GMLIB::Mod::CustomRecipe::registerShapelessCraftingTableRecipe(recipe_id, types, *result); - throw std::runtime_error("GMLIB_API::registerCustomShapelessRecipe is not implemented"); + if (!GMLevel::getInstance().has_value()) return; + std::vector types; + for (auto& ing : ingredients) { + types.push_back(ICustomRecipe::Ingredient{ing}); + } + CustomRecipeRegistry::getInstance().registerShapelessRecipe( + recipe_id, + types, + ItemInstance(*result->getItem(), result->mCount, result->mAuxValue, result->mUserData.get()) + ); } ); RemoteCall::exportAs( diff --git a/src/Entry.cpp b/src/Entry.cpp index b0d6dc6..7982661 100644 --- a/src/Entry.cpp +++ b/src/Entry.cpp @@ -9,6 +9,7 @@ LegacyRemoteCallApi& LegacyRemoteCallApi::getInstance() { } bool LegacyRemoteCallApi::load() { + (void)CustomRecipeRegistry::getInstance(); Export_Legacy_GMLib_ModAPI(); Export_Legacy_GMLib_ServerAPI(); Export_Compatibility_API(); @@ -39,4 +40,6 @@ LL_REGISTER_MOD(gmlib::LegacyRemoteCallApi, gmlib::LegacyRemoteCallApi::getInsta ll::thread::ThreadPoolExecutor const& getThreadPoolExecutor() { return gmlib::LegacyRemoteCallApi::getInstance().getThreadPoolExecutor(); -} \ No newline at end of file +} + +ll::io::Logger& getLogger() { return gmlib::LegacyRemoteCallApi::getInstance().getSelf().getLogger(); } \ No newline at end of file diff --git a/src/EventAPI.cpp b/src/EventAPI.cpp index d3ae8f6..b989b74 100644 --- a/src/EventAPI.cpp +++ b/src/EventAPI.cpp @@ -141,7 +141,7 @@ void Export_Event_API() { REGISTER_EVENT_LISTEN( ila::mc::SpawnItemActorAfterEvent, (Actor * item, std::pair position, int64 spawnerUniqueId), - (event.itemActor(), + (&event.itemActor(), {event.pos(), event.blockSource().getDimensionId().id}, event.spawner() ? event.spawner()->getOrCreateUniqueID().rawID : -1), , diff --git a/src/Global.h b/src/Global.h index f094791..670d035 100644 --- a/src/Global.h +++ b/src/Global.h @@ -1,10 +1,11 @@ #pragma once // clang-format off -#define GMLIB_Gloabl_Using +#define GMLIB_GLOBAL_USING #include #include #include #include +using namespace gmlib::mod; // clang-format on #define PLUGIN_NAME fmt::format(fg(fmt::color::light_green), "GMLIB-LRCA") @@ -27,4 +28,5 @@ extern void ExportPAPI(); extern void Export_Event_API(); extern void Export_BinaryStream_API(); extern ll::thread::ThreadPoolExecutor const& getThreadPoolExecutor(); +extern ll::io::Logger& getLogger(); // extern void Export_Form_API(); \ No newline at end of file diff --git a/src/LegacyModApi.cpp b/src/LegacyModApi.cpp index 6da72c0..fa36b6f 100644 --- a/src/LegacyModApi.cpp +++ b/src/LegacyModApi.cpp @@ -1,12 +1,13 @@ #include "Global.h" +#include "gmlib/mod/recipe/CustomRecipeRegistry.h" #include #include std::unordered_set HardCodedKeys = {"AlwaysUnlocked", "PlayerHasManyItems", "PlayerInWater", "None"}; -std::variant> makeRecipeUnlockingKey(std::string const& key) { - if (HardCodedKeys.count(key)) return key; - return std::vector({RecipeIngredient(key, 0, 1)}); +ICustomRecipe::UnlockingRequirement makeRecipeUnlockingKey(std::string const& key) { + if (HardCodedKeys.count(key)) return {{ICustomRecipe::Ingredient{key}}}; + return ICustomRecipe::UnlockingRequirement({ICustomRecipe::Ingredient(key, 1, 0)}); } void Export_Legacy_GMLib_ModAPI() { @@ -19,18 +20,13 @@ void Export_Legacy_GMLib_ModAPI() { std::string const& result, int count, std::string const& unlock) -> void { - // if (!GMLIB_Level::getInstance().has_value()) return; - // std::vector types; - // for (auto ing : ingredients) { - // types.emplace_back(ing, 0, 1); - // } - // GMLIB::Mod::JsonRecipe::registerShapelessCraftingTableRecipe( - // recipe_id, - // types, - // RecipeIngredient(result, 0, count), - // makeRecipeUnlockingKey(unlock) - // ); - throw std::runtime_error("GMLib_ModAPI::registerShapelessRecipe is not implemented"); + if (!GMLevel::getInstance().has_value()) return; + std::vector types; + for (auto& ing : ingredients) { + types.emplace_back(ICustomRecipe::Ingredient{ing, 1}); + } + CustomRecipeRegistry::getInstance() + .registerShapelessRecipe(recipe_id, types, ItemInstance(result, count), makeRecipeUnlockingKey(unlock)); } ); RemoteCall::exportAs( @@ -42,19 +38,20 @@ void Export_Legacy_GMLib_ModAPI() { std::string const& result, int count, std::string const& unlock) -> void { - // if (!GMLIB_Level::getInstance().has_value()) return; - // std::vector types; - // for (auto ing : ingredients) { - // types.push_back(RecipeIngredient(ing, 0, 1)); - // } - // GMLIB::Mod::JsonRecipe::registerShapedCraftingTableRecipe( - // recipe_id, - // shape, - // types, - // RecipeIngredient(result, 0, count), - // makeRecipeUnlockingKey(unlock) - // ); - throw std::runtime_error("GMLib_ModAPI::registerShapedRecipe is not implemented"); + if (!GMLevel::getInstance().has_value()) return; + ICustomShapedRecipe::ShapedIngredients types; + char index = 'a'; + for (auto& ing : ingredients) { + types.add(std::string{index++}, ICustomRecipe::Ingredient{ing, 1}); + } + CustomRecipeRegistry::getInstance().registerShapedRecipe( + recipe_id, + shape, + types, + ItemInstance(result, count), + makeRecipeUnlockingKey(unlock) + ); + } ); RemoteCall::exportAs( @@ -64,14 +61,9 @@ void Export_Legacy_GMLib_ModAPI() { std::string const& input, std::string const& output, std::vector tags) -> void { - // if (!GMLIB_Level::getInstance().has_value()) return; - // GMLIB::Mod::JsonRecipe::registerFurnaceRecipe( - // recipe_id, - // RecipeIngredient(input, 0, 1), - // RecipeIngredient(output, 0, 1), - // tags - // ); - throw std::runtime_error("GMLib_ModAPI::registerFurnaceRecipe is not implemented"); + if (!GMLevel::getInstance().has_value()) return; + CustomRecipeRegistry::getInstance() + .registerFurnaceRecipe(ICustomRecipe::Ingredient{input}, ItemInstance{output}, tags); } ); RemoteCall::exportAs( @@ -79,10 +71,12 @@ void Export_Legacy_GMLib_ModAPI() { "registerBrewingMixRecipe", [](std::string const& recipe_id, std::string const& input, std::string const& output, std::string const& reagent ) -> void { - // if (!GMLIB_Level::getInstance().has_value()) return; - // GMLIB::Mod::JsonRecipe::registerBrewingMixRecipe(recipe_id, input, output, RecipeIngredient(reagent, 0, - // 1)); - throw std::runtime_error("GMLib_ModAPI::registerBrewingMixRecipe is not implemented"); + if (!GMLevel::getInstance().has_value()) return; + CustomRecipeRegistry::getInstance().registerBrewingRecipe( + ICustomRecipe::Ingredient{input}, + ICustomRecipe::Ingredient{reagent}, + ICustomRecipe::Ingredient{output} + ); } ); RemoteCall::exportAs( @@ -90,14 +84,12 @@ void Export_Legacy_GMLib_ModAPI() { "registerBrewingContainerRecipe", [](std::string const& recipe_id, std::string const& input, std::string const& output, std::string const& reagent ) -> void { - // if (!GMLIB_Level::getInstance().has_value()) return; - // GMLIB::Mod::JsonRecipe::registerBrewingContainerRecipe( - // recipe_id, - // RecipeIngredient(input, 0, 1), - // RecipeIngredient(output, 0, 1), - // RecipeIngredient(reagent, 0, 1) - // ); - throw std::runtime_error("GMLib_ModAPI::registerBrewingContainerRecipe is not implemented"); + if (!GMLevel::getInstance().has_value()) return; + CustomRecipeRegistry::getInstance().registerBrewingRecipe( + ICustomRecipe::Ingredient{input}, + ICustomRecipe::Ingredient{reagent}, + ICustomRecipe::Ingredient{output} + ); } ); RemoteCall::exportAs( @@ -108,15 +100,14 @@ void Export_Legacy_GMLib_ModAPI() { std::string const& base, std::string const& addition, std::string const& result) -> void { - // if (!GMLIB_Level::getInstance().has_value()) return; - // GMLIB::Mod::JsonRecipe::registerSmithingTransformRecipe( - // recipe_id, - // smithing_template, - // base, - // addition, - // result - // ); - throw std::runtime_error("GMLib_ModAPI::registerSmithingTransformRecipe is not implemented"); + if (!GMLevel::getInstance().has_value()) return; + CustomRecipeRegistry::getInstance().registerSmithingTransformRecipe( + recipe_id, + ICustomRecipe::Ingredient{smithing_template}, + ICustomRecipe::Ingredient{base}, + ICustomRecipe::Ingredient{addition}, + ItemInstance{result} + ); } ); RemoteCall::exportAs( @@ -126,9 +117,13 @@ void Export_Legacy_GMLib_ModAPI() { std::string const& smithing_template, std::string const& base, std::string const& addition) -> void { - // if (!GMLIB_Level::getInstance().has_value()) return; - // GMLIB::Mod::JsonRecipe::registerSmithingTrimRecipe(recipe_id, smithing_template, base, addition); - throw std::runtime_error("GMLib_ModAPI::registerSmithingTrimRecipe is not implemented"); + if (!GMLevel::getInstance().has_value()) return; + CustomRecipeRegistry::getInstance().registerSmithingTrimRecipe( + recipe_id, + ICustomRecipe::Ingredient{smithing_template}, + ICustomRecipe::Ingredient{base}, + ICustomRecipe::Ingredient{addition} + ); } ); RemoteCall::exportAs( @@ -140,19 +135,17 @@ void Export_Legacy_GMLib_ModAPI() { std::string const& output, int output_data, int output_count) -> void { - // if (!GMLIB_Level::getInstance().has_value()) return; - // GMLIB::Mod::JsonRecipe::registerStoneCutterRecipe( - // recipe_id, - // RecipeIngredient(input, 0, 1), - // RecipeIngredient(output, 0, 1) - // ); - throw std::runtime_error("GMLib_ModAPI::registerStoneCutterRecipe is not implemented"); + if (!GMLevel::getInstance().has_value()) return; + CustomRecipeRegistry::getInstance().registerStoneCutterRecipe( + recipe_id, + ICustomRecipe::Ingredient{input, 1, input_data}, + {output, output_count, output_data} + ); } ); // 错误方块清理 RemoteCall::exportAs("GMLib_ModAPI", "setUnknownBlockCleaner", []() -> void { - // GMLIB::Mod::VanillaFix::setAutoCleanUnknownBlockEnabled(); - throw std::runtime_error("GMLib_ModAPI::setUnknownBlockCleaner is not implemented"); + getLogger().error("setUnknownBlockCleaner is not implemented"); }); // 实验性 RemoteCall::exportAs("GMLib_ModAPI", "registerExperimentsRequire", [](int experiment_id) -> void { @@ -172,8 +165,5 @@ void Export_Legacy_GMLib_ModAPI() { .transform([&](GMLevel& level) { return level.getExperimentEnabled((AllExperiments)experiment_id); }) .value_or(false); }); - RemoteCall::exportAs("GMLib_ModAPI", "setFixI18nEnabled", []() -> void { - // GMLIB::Mod::VanillaFix::setFixI18nEnabled(); - throw std::runtime_error("GMLib_ModAPI::setFixI18nEnabled is not implemented"); - }); + RemoteCall::exportAs("GMLib_ModAPI", "setFixI18nEnabled", []() -> void {}); } \ No newline at end of file diff --git a/src/LegacyServerApi.cpp b/src/LegacyServerApi.cpp index b756b16..0d28564 100644 --- a/src/LegacyServerApi.cpp +++ b/src/LegacyServerApi.cpp @@ -2,24 +2,19 @@ void Export_Legacy_GMLib_ServerAPI() { RemoteCall::exportAs("GMLib_ServerAPI", "setEducationFeatureEnabled", []() -> void { - // GMLIB_Level::tryEnableEducationEdition(); - throw std::runtime_error("GMLib_ServerAPI::setEducationFeatureEnabled is not implemented"); + getLogger().error("GMLib_ServerAPI::setEducationFeatureEnabled is not implemented"); }); RemoteCall::exportAs("GMLib_ServerAPI", "registerAbilityCommand", []() -> void { - // GMLIB_Level::tryRegisterAbilityCommand(); - throw std::runtime_error("GMLib_ServerAPI::registerAbilityCommand is not implemented"); + getLogger().error("GMLib_ServerAPI::registerAbilityCommand is not implemented"); }); RemoteCall::exportAs("GMLib_ServerAPI", "setEnableAchievement", []() -> void { - // GMLIB_Level::setForceAchievementsEnabled(); - throw std::runtime_error("GMLib_ServerAPI::setEnableAchievement is not implemented"); + getLogger().error("GMLib_ServerAPI::setEnableAchievement is not implemented"); }); RemoteCall::exportAs("GMLib_ServerAPI", "setForceTrustSkins", []() -> void { - // GMLIB_Level::trustAllSkins(); - throw std::runtime_error("GMLib_ServerAPI::setForceTrustSkins is not implemented"); + getLogger().error("GMLib_ServerAPI::setForceTrustSkins is not implemented"); }); RemoteCall::exportAs("GMLib_ServerAPI", "enableCoResourcePack", []() -> void { - // GMLIB_Level::requireServerResourcePackAndAllowClientResourcePack(); - throw std::runtime_error("GMLib_ServerAPI::enableCoResourcePack is not implemented"); + getLogger().error("GMLib_ServerAPI::enableCoResourcePack is not implemented"); }); RemoteCall::exportAs("GMLib_ServerAPI", "getLevelName", []() -> std::string { return GMLevel::getInstance().transform( @@ -37,8 +32,7 @@ void Export_Legacy_GMLib_ServerAPI() { .value_or(""); }); RemoteCall::exportAs("GMLib_ServerAPI", "setFakeSeed", [](int64_t seed) -> void { - // return GMLIB_Level::setFakeSeed(seed); - throw std::runtime_error("GMLib_ServerAPI::setFakeSeed is not implemented"); + getLogger().error("GMLib_ServerAPI::setFakeSeed is not implemented"); }); RemoteCall::exportAs( "GMLib_ServerAPI", diff --git a/xmake.lua b/xmake.lua index 7f27974..4f47bd2 100644 --- a/xmake.lua +++ b/xmake.lua @@ -10,7 +10,6 @@ end add_requires("levilamina", {configs = {target_type = "server"}}) add_requires("legacyremotecall") -add_requires("gmlib") add_requires("levibuildscript") add_requires("ilistenattentively") @@ -28,12 +27,13 @@ target("GMLIB-LegacyRemoteCallApi") "src/**.cpp" ) add_includedirs( - "src" + "src", + "../GMLIB/bin/SDK/include" ) + add_links("../GMLIB/bin/SDK/lib/GMLIB.lib") add_packages( "levilamina", "legacyremotecall", - "gmlib", "ilistenattentively" ) add_rules("@levibuildscript/linkrule")