Compare commits

..

4 Commits

12 changed files with 93 additions and 38 deletions
-4
View File
@@ -9,10 +9,6 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/checkout@v4
- uses: xmake-io/github-action-setup-xmake@v1 - uses: xmake-io/github-action-setup-xmake@v1
-4
View File
@@ -9,10 +9,6 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/checkout@v4
- uses: xmake-io/github-action-setup-xmake@v1 - uses: xmake-io/github-action-setup-xmake@v1
-3
View File
@@ -1,3 +0,0 @@
[submodule "SDK-GMLIB"]
path = SDK-GMLIB
url = https://github.com/GroupMountain/SDK-GMLIB.git
Submodule SDK-GMLIB deleted from 710cc6e4c3
+38 -1
View File
@@ -110,7 +110,12 @@ const GMLIB_API = {
addFakeList: ll.import("GMLIB_API", "addFakeList"), addFakeList: ll.import("GMLIB_API", "addFakeList"),
removeFakeList: ll.import("GMLIB_API", "removeFakeList"), removeFakeList: ll.import("GMLIB_API", "removeFakeList"),
removeAllFakeLists: ll.import("GMLIB_API", "removeAllFakeList"), removeAllFakeLists: ll.import("GMLIB_API", "removeAllFakeList"),
setFixI18nEnabled: ll.import("GMLib_ModAPI", "setFixI18nEnabled") setFixI18nEnabled: ll.import("GMLib_ModAPI", "setFixI18nEnabled"),
getBlockTranslateKey: ll.import("GMLIB_API", "getBlockTranslateKey"),
getItemTranslateKey: ll.import("GMLIB_API", "getItemTranslateKey"),
getEntityTranslateKey: ll.import("GMLIB_API", "getEntityTranslateKey"),
readNbtFromFile: ll.import("GMLIB_API", "readNbtFromFile"),
saveNbtToFile: ll.import("GMLIB_API", "saveNbtToFile")
} }
const FloatingTextList = []; const FloatingTextList = [];
@@ -427,6 +432,14 @@ class Minecraft {
static setFixI18nEnabled() { static setFixI18nEnabled() {
GMLIB_API.setFixI18nEnabled(); GMLIB_API.setFixI18nEnabled();
} }
static saveNbtToFile(path, nbt, isBinary = true) {
return GMLIB_API.saveNbtToFile(path, nbt, isBinary);
}
static readNbtFromFile(path, isBinary = true) {
return GMLIB_API.readNbtFromFile(path, isBinary);
}
} }
class Recipes { class Recipes {
@@ -926,6 +939,30 @@ LLSE_Entity.prototype.throwEntity = function (proj, speed = 2, offset = 3) {
return GMLIB_API.throwEntity(this, proj, speed, offset); return GMLIB_API.throwEntity(this, proj, speed, offset);
} }
LLSE_Entity.prototype.getTranslateKey = function () {
return GMLIB_API.getEntityTranslateKey(this);
}
LLSE_Entity.prototype.getTranslateName = function (language) {
return I18nAPI.get(this.getTranslateKey(), [], language);
}
LLSE_Block.prototype.getTranslateKey = function () {
return GMLIB_API.getBlockTranslateKey(this);
}
LLSE_Block.prototype.getTranslateName = function (language) {
return I18nAPI.get(this.getTranslateKey(), [], language);
}
LLSE_Item.prototype.getTranslateKey = function () {
return GMLIB_API.getItemTranslateKey(this);
}
LLSE_Item.prototype.getTranslateName = function (language) {
return I18nAPI.get(this.getTranslateKey(), [], language);
}
module.exports = { module.exports = {
StaticFloatingText, StaticFloatingText,
DynamicFloatingText, DynamicFloatingText,
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "${pluginName}", "name": "${pluginName}",
"entry": "${pluginFile}", "entry": "${pluginFile}",
"version": "0.12.6", "version": "0.12.7",
"author": "GroupMountain", "author": "GroupMountain",
"type": "native", "type": "native",
"dependencies": [ "dependencies": [
+28 -1
View File
@@ -198,7 +198,8 @@ void Export_Compatibility_API() {
RemoteCall::exportAs( RemoteCall::exportAs(
"GMLIB_API", "GMLIB_API",
"updateOrCreateLanguageFile", "updateOrCreateLanguageFile",
[](std::string const& code, std::string const& lang, std::string const& path) -> void { [](std::string const& code, std::unordered_map<std::string, std::string> lang, std::string const& path
) -> void {
if (GMLIB_Level::getInstance()) { if (GMLIB_Level::getInstance()) {
I18nAPI::updateOrCreateLanguageFile(path, code, lang); I18nAPI::updateOrCreateLanguageFile(path, code, lang);
} }
@@ -603,4 +604,30 @@ void Export_Compatibility_API() {
} }
return 0; return 0;
}); });
RemoteCall::exportAs("GMLIB_API", "getBlockTranslateKey", [](Block const* block) -> std::string {
return block->buildDescriptionId();
});
RemoteCall::exportAs("GMLIB_API", "getItemTranslateKey", [](ItemStack* item) -> std::string {
return item->getDescriptionId();
});
RemoteCall::exportAs("GMLIB_API", "getEntityTranslateKey", [](Actor* entity) -> std::string {
return entity->getEntityLocNameString();
});
RemoteCall::exportAs(
"GMLIB_API",
"readNbtFromFile",
[](std::string const& path, bool isBinary) -> std::unique_ptr<CompoundTag> {
if (auto nbt = GMLIB_CompoundTag::readFromFile(path, isBinary)) {
return std::make_unique<CompoundTag>(nbt.value());
}
return nullptr;
}
);
RemoteCall::exportAs(
"GMLIB_API",
"saveNbtToFile",
[](std::string const& path, CompoundTag* nbt, bool isBinary) -> bool {
return GMLIB_CompoundTag::saveToFile(path, *nbt, isBinary);
}
);
} }
+8 -8
View File
@@ -3,14 +3,14 @@
ll::Logger logger(PLUGIN_NAME); ll::Logger logger(PLUGIN_NAME);
namespace GMLIB_LegacyRemoteCallApi { namespace GMLIB {
std::unique_ptr<LRCA>& LRCA::getInstance() { std::unique_ptr<LegacyRemoteCallApi>& LegacyRemoteCallApi::getInstance() {
static std::unique_ptr<LRCA> instance; static std::unique_ptr<LegacyRemoteCallApi> instance;
return instance; return instance;
} }
bool LRCA::load() { bool LegacyRemoteCallApi::load() {
Export_Legacy_GMLib_ModAPI(); Export_Legacy_GMLib_ModAPI();
Export_Legacy_GMLib_ServerAPI(); Export_Legacy_GMLib_ServerAPI();
Export_Compatibility_API(); Export_Compatibility_API();
@@ -27,10 +27,10 @@ bool LRCA::load() {
return true; return true;
} }
bool LRCA::enable() { return true; } bool LegacyRemoteCallApi::enable() { return true; }
bool LRCA::disable() { return true; } bool LegacyRemoteCallApi::disable() { return true; }
} // namespace GMLIB_LegacyRemoteCallApi } // namespace GMLIB
LL_REGISTER_PLUGIN(GMLIB_LegacyRemoteCallApi::LRCA, GMLIB_LegacyRemoteCallApi::LRCA::getInstance()); LL_REGISTER_PLUGIN(GMLIB::LegacyRemoteCallApi, GMLIB::LegacyRemoteCallApi::getInstance());
+5 -5
View File
@@ -2,14 +2,14 @@
#include <ll/api/plugin/NativePlugin.h> #include <ll/api/plugin/NativePlugin.h>
#include <ll/api/plugin/RegisterHelper.h> #include <ll/api/plugin/RegisterHelper.h>
namespace GMLIB_LegacyRemoteCallApi { namespace GMLIB {
class LRCA { class LegacyRemoteCallApi {
public: public:
static std::unique_ptr<LRCA>& getInstance(); static std::unique_ptr<LegacyRemoteCallApi>& getInstance();
LRCA(ll::plugin::NativePlugin& self) : mSelf(self) {} LegacyRemoteCallApi(ll::plugin::NativePlugin& self) : mSelf(self) {}
[[nodiscard]] ll::plugin::NativePlugin& getSelf() const { return mSelf; } [[nodiscard]] ll::plugin::NativePlugin& getSelf() const { return mSelf; }
@@ -30,4 +30,4 @@ private:
ll::plugin::NativePlugin& mSelf; ll::plugin::NativePlugin& mSelf;
}; };
} // namespace GMLIB_LegacyRemoteCallApi } // namespace GMLIB
+5 -1
View File
@@ -5,7 +5,11 @@
#define PLUGIN_NAME fmt::format(fg(fmt::color::light_green), "GMLIB-LRCA") #define PLUGIN_NAME fmt::format(fg(fmt::color::light_green), "GMLIB-LRCA")
#define LIB_VERSION GMLIB::Version(0, 12, 6) #define LIB_VERSION_MAJOR 0
#define LIB_VERSION_MINOR 12
#define LIB_VERSION_PATCH 7
#define LIB_VERSION GMLIB::Version(LIB_VERSION_MAJOR, LIB_VERSION_MINOR, LIB_VERSION_PATCH)
extern ll::Logger logger; extern ll::Logger logger;
+3 -3
View File
@@ -1,7 +1,7 @@
{ {
"format_version": 2, "format_version": 2,
"tooth": "github.com/GroupMountain/GMLIB-LegacyRemoteCallApi", "tooth": "github.com/GroupMountain/GMLIB-LegacyRemoteCallApi",
"version": "0.12.6", "version": "0.12.7",
"info": { "info": {
"name": "GMLIB-LegacyRemoteCallApi", "name": "GMLIB-LegacyRemoteCallApi",
"description": "Legacy RemoteCall API for GMLIB", "description": "Legacy RemoteCall API for GMLIB",
@@ -14,9 +14,9 @@
"library" "library"
] ]
}, },
"asset_url": "https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi/releases/download/v0.12.6/GMLIB-LegacyRemoteCallApi-windows-x64.zip", "asset_url": "https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi/releases/download/v0.12.7/GMLIB-LegacyRemoteCallApi-windows-x64.zip",
"dependencies": { "dependencies": {
"github.com/GroupMountain/GMLIB": ">=0.12.4" "github.com/GroupMountain/GMLIB": ">=0.12.7"
}, },
"files": { "files": {
"place": [ "place": [
+4 -5
View File
@@ -1,6 +1,7 @@
add_rules("mode.debug", "mode.release") add_rules("mode.debug", "mode.release")
add_repositories("liteldev-repo https://github.com/LiteLDev/xmake-repo.git") add_repositories("liteldev-repo https://github.com/LiteLDev/xmake-repo.git")
add_repositories("groupmountain-repo https://github.com/GroupMountain/xmake-repo.git")
if not has_config("vs_runtime") then if not has_config("vs_runtime") then
set_runtimes("MD") set_runtimes("MD")
@@ -9,6 +10,7 @@ end
-- Option 1: Use the latest version of LeviLamina released on GitHub. -- Option 1: Use the latest version of LeviLamina released on GitHub.
add_requires("levilamina") add_requires("levilamina")
add_requires("legacyremotecall") add_requires("legacyremotecall")
add_requires("gmlib")
-- Option 2: Use a specific version of LeviLamina released on GitHub. -- Option 2: Use a specific version of LeviLamina released on GitHub.
-- add_requires("levilamina x.x.x") -- add_requires("levilamina x.x.x")
@@ -53,16 +55,13 @@ target("GMLIB-LegacyRemoteCallApi") -- Change this to your plugin name.
add_files( add_files(
"src/**.cpp" "src/**.cpp"
) )
add_links(
"SDK-GMLIB/Lib/GMLIB"
)
add_includedirs( add_includedirs(
"SDK-GMLIB",
"src" "src"
) )
add_packages( add_packages(
"levilamina", "levilamina",
"legacyremotecall" "legacyremotecall",
"gmlib"
) )
add_shflags( add_shflags(
"/DELAYLOAD:bedrock_server.dll" -- Magic to import symbols from BDS "/DELAYLOAD:bedrock_server.dll" -- Magic to import symbols from BDS