Compare commits

..

2 Commits

5 changed files with 21 additions and 41 deletions
+10 -30
View File
@@ -1,6 +1,3 @@
// LiteLoader-AIDS automatic generated
/// <reference path="D:\LiteLoader\VSCode/dts/HelperLib-master/src/index.d.ts"/>
const GMLIB_API = { const GMLIB_API = {
createFloatingText: ll.import("GMLIB_API", "createFloatingText"), createFloatingText: ll.import("GMLIB_API", "createFloatingText"),
deleteFloatingText: ll.import("GMLIB_API", "deleteFloatingText"), deleteFloatingText: ll.import("GMLIB_API", "deleteFloatingText"),
@@ -36,7 +33,7 @@ const GMLIB_API = {
PlayerToEntity: ll.import("GMLib_ServerAPI", "PlayerToEntity"), PlayerToEntity: ll.import("GMLib_ServerAPI", "PlayerToEntity"),
setUnknownBlockCleaner: ll.import("GMLib_ModAPI", "setUnknownBlockCleaner"), setUnknownBlockCleaner: ll.import("GMLib_ModAPI", "setUnknownBlockCleaner"),
getAllExperiments: ll.import("GMLIB_API", "getAllExperiments"), getAllExperiments: ll.import("GMLIB_API", "getAllExperiments"),
getExperimentTranslatedName: ll.import("GMLIB_API", "getExperimentTranslatedName"), getExperimentTranslateKey: ll.import("GMLIB_API", "getExperimentTranslateKey"),
getExperimentEnabled: ll.import("GMLib_ModAPI", "getExperimentEnabled"), getExperimentEnabled: ll.import("GMLib_ModAPI", "getExperimentEnabled"),
setExperimentEnabled: ll.import("GMLib_ModAPI", "setExperimentEnabled"), setExperimentEnabled: ll.import("GMLib_ModAPI", "setExperimentEnabled"),
unregisterRecipe: ll.import("GMLIB_API", "unregisterRecipe"), unregisterRecipe: ll.import("GMLIB_API", "unregisterRecipe"),
@@ -435,18 +432,8 @@ class Experiments {
return GMLIB_API.getAllExperiments(); return GMLIB_API.getAllExperiments();
} }
static getExperimentTranslatedName(id) { static getExperimentTranslateKey(id) {
return GMLIB_API.getExperimentTranslatedName(id); return GMLIB_API.getExperimentTranslateKey(id);
}
static getExperimentsMap() {
let ids = this.getAllExperimentIds();
let result = {};
for (let id in ids) {
let name = this.getExperimentTranslatedName(id);
result[id] = name;
}
return result;
} }
static getExperimentEnabled(id) { static getExperimentEnabled(id) {
@@ -502,28 +489,22 @@ class Version {
if (Array.isArray(array) && array.length == 3) { if (Array.isArray(array) && array.length == 3) {
let isNumber = array.every(element => typeof element == "number"); let isNumber = array.every(element => typeof element == "number");
if (isNumber) { if (isNumber) {
return new Version(array[0], array[1], array[2]) return new Version(array[0], array[1], array[2]);
} }
} }
return null; return null;
} }
}
class GMLIB { static isPluginVersionMatched(version) {
constructor() { return GMLIB_API.isVersionMatched(version.mMajor, version.mMinor, version.mPatch);
throw new Error("Static class cannot be instantiated");
} }
static isVersionMatched(major, minor, patch) { static getLrcaVersion() {
return GMLIB_API.isVersionMatched(major, minor, patch); return Version.fromString(GMLIB_API.getVersion_LRCA());
} }
static getVersion_LRCA() { static getGmlibVersion() {
return GMLIB_API.getVersion_LRCA(); return Version.fromString(GMLIB_API.getVersion_GMLIB());
}
static getVersion_GMLIB() {
return GMLIB_API.getVersion_GMLIB();
} }
} }
@@ -879,7 +860,6 @@ module.exports = {
Minecraft, Minecraft,
Recipes, Recipes,
Experiments, Experiments,
GMLIB,
Scoreboard, Scoreboard,
JsonConfig, JsonConfig,
JsonLanguage, JsonLanguage,
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "${pluginName}", "name": "${pluginName}",
"entry": "${pluginFile}", "entry": "${pluginFile}",
"version": "0.12.4", "version": "0.12.5",
"author": "GroupMountain", "author": "GroupMountain",
"type": "native", "type": "native",
"dependencies": [ "dependencies": [
+7 -7
View File
@@ -77,12 +77,12 @@ void Export_Compatibility_API() {
} }
return result; return result;
}); });
RemoteCall::exportAs("GMLIB_API", "getExperimentTranslatedName", [](int id) -> std::string { RemoteCall::exportAs("GMLIB_API", "getExperimentTranslateKey", [](int id) -> std::string {
auto map = GMLIB_Level::getAllExperimentsTranslateKeys(); std::string result;
if (map.count(id)) { try {
return std::string(map[id]); result = Experiments::getExperimentTextID(AllExperiments(id));
} } catch (...) {}
return ""; return result;
}); });
RemoteCall::exportAs( RemoteCall::exportAs(
"GMLIB_API", "GMLIB_API",
@@ -153,7 +153,7 @@ void Export_Compatibility_API() {
}); });
RemoteCall::exportAs("GMLIB_API", "isVersionMatched", [](int a, int b, int c) -> bool { RemoteCall::exportAs("GMLIB_API", "isVersionMatched", [](int a, int b, int c) -> bool {
auto version = GMLIB::Version(a, b, c, "", ""); auto version = GMLIB::Version(a, b, c, "", "");
return version >= LIB_VERSION; return LIB_VERSION >= version;
}); });
RemoteCall::exportAs("GMLIB_API", "getVersion_LRCA", []() -> std::string { return LIB_VERSION.asString(); }); RemoteCall::exportAs("GMLIB_API", "getVersion_LRCA", []() -> std::string { return LIB_VERSION.asString(); });
RemoteCall::exportAs("GMLIB_API", "getVersion_GMLIB", []() -> std::string { RemoteCall::exportAs("GMLIB_API", "getVersion_GMLIB", []() -> std::string {
+1 -1
View File
@@ -5,7 +5,7 @@
#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, 4) #define LIB_VERSION GMLIB::Version(0, 12, 5)
extern ll::Logger logger; extern ll::Logger logger;
+2 -2
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.4", "version": "0.12.5",
"info": { "info": {
"name": "GMLIB-LegacyRemoteCallApi", "name": "GMLIB-LegacyRemoteCallApi",
"description": "Legacy RemoteCall API for GMLIB", "description": "Legacy RemoteCall API for GMLIB",
@@ -14,7 +14,7 @@
"library" "library"
] ]
}, },
"asset_url": "https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi/releases/download/v0.12.4/GMLIB-LegacyRemoteCallApi-windows-x64.zip", "asset_url": "https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi/releases/download/v0.12.5/GMLIB-LegacyRemoteCallApi-windows-x64.zip",
"dependencies": { "dependencies": {
"github.com/GroupMountain/GMLIB": ">=0.12.4" "github.com/GroupMountain/GMLIB": ">=0.12.4"
}, },