Compare commits

...

9 Commits

8 changed files with 56 additions and 24 deletions
-3
View File
@@ -8,9 +8,7 @@ const PAPIunRegisterPlaceholderAPI = ll.import("BEPlaceholderAPI", "unRegisterPl
const PAPIgetAllPAPI = ll.import("BEPlaceholderAPI", "getAllPAPI") const PAPIgetAllPAPI = ll.import("BEPlaceholderAPI", "getAllPAPI")
Function.prototype.getName = function () { Function.prototype.getName = function () {
return this.name || this.toString().match(/function\s*([^(]*)\(/)[1] return this.name || this.toString().match(/function\s*([^(]*)\(/)[1]
} }
class PAPI { class PAPI {
@@ -19,7 +17,6 @@ class PAPI {
} }
static registerPlayerPlaceholder(func, PluginName, PAPIName) { static registerPlayerPlaceholder(func, PluginName, PAPIName) {
ll.export(func, PluginName, func.getName()) ll.export(func, PluginName, func.getName())
PAPIregisterPlayerPlaceholderAPI(PluginName, func.getName(), PAPIName) PAPIregisterPlayerPlaceholderAPI(PluginName, func.getName(), PAPIName)
} }
+30 -9
View File
@@ -28,14 +28,17 @@ const GMLIB_API = {
getExperimentEnabled: ll.import("GMLib_ModAPI", "getExperimentEnabled"), getExperimentEnabled: ll.import("GMLib_ModAPI", "getExperimentEnabled"),
setExperimentEnabled: ll.import("GMLib_ModAPI", "setExperimentEnabled"), setExperimentEnabled: ll.import("GMLib_ModAPI", "setExperimentEnabled"),
registerExperimentsRequire: ll.import("GMLib_ModAPI", "registerExperimentsRequire"), registerExperimentsRequire: ll.import("GMLib_ModAPI", "registerExperimentsRequire"),
registerExperimentsRequire: ll.import("GMLib_ModAPI", "registerStoneCutterRecipe"), registerStoneCutterRecipe: ll.import("GMLib_ModAPI", "registerStoneCutterRecipe"),
registerExperimentsRequire: ll.import("GMLib_ModAPI", "registerSmithingTrimRecipe"), registerSmithingTrimRecipe: ll.import("GMLib_ModAPI", "registerSmithingTrimRecipe"),
registerExperimentsRequire: ll.import("GMLib_ModAPI", "registerSmithingTransformRecipe"), registerSmithingTransformRecipe: ll.import("GMLib_ModAPI", "registerSmithingTransformRecipe"),
registerExperimentsRequire: ll.import("GMLib_ModAPI", "registerBrewingContainerRecipe"), registerBrewingContainerRecipe: ll.import("GMLib_ModAPI", "registerBrewingContainerRecipe"),
registerExperimentsRequire: ll.import("GMLib_ModAPI", "registerBrewingMixRecipe"), registerBrewingMixRecipe: ll.import("GMLib_ModAPI", "registerBrewingMixRecipe"),
registerExperimentsRequire: ll.import("GMLib_ModAPI", "registerFurnaceRecipe"), registerFurnaceRecipe: ll.import("GMLib_ModAPI", "registerFurnaceRecipe"),
registerExperimentsRequire: ll.import("GMLib_ModAPI", "registerShapedRecipe"), registerShapedRecipe: ll.import("GMLib_ModAPI", "registerShapedRecipe"),
registerExperimentsRequire: ll.import("GMLib_ModAPI", "registerShapelessRecipe") registerShapelessRecipe: ll.import("GMLib_ModAPI", "registerShapelessRecipe"),
isVersionMatched: ll.import("GMLIB_API", "isVersionMatched"),
getVersion_LRCA: ll.import("GMLIB_API", "getVersion_LRCA"),
getVersion_GMLIB: ll.import("GMLIB_API", "getVersion_GMLIB")
} }
const FloatingTextList = []; const FloatingTextList = [];
@@ -346,4 +349,22 @@ class Experiments {
} }
} }
module.exports = { StaticFloatingText, DynamicFloatingText, Minecraft, Recipes, Experiments }; class GMLIB {
constructor() {
throw new Error("Static class cannot be instantiated");
}
static isVersionMatched(major, minor, patch) {
return GMLIB_API.isVersionMatched(major, minor, patch);
}
static getVersion_LRCA() {
return GMLIB_API.getVersion_LRCA();
}
static getVersion_GMLIB() {
return GMLIB_API.getVersion_GMLIB();
}
}
module.exports = { StaticFloatingText, DynamicFloatingText, Minecraft, Recipes, Experiments, GMLIB };
+8
View File
@@ -91,4 +91,12 @@ void Export_Compatibility_API() {
} }
return false; return false;
}); });
RemoteCall::exportAs("GMLIB_API", "isVersionMatched", [](int a, int b, int c) -> bool {
auto version = SemVersion(a, b, c, "", "");
return LIB_VERSION.satisfies(version);
});
RemoteCall::exportAs("GMLIB_API", "getVersion_LRCA", []() -> std::string { return LIB_VERSION.asString(); });
RemoteCall::exportAs("GMLIB_API", "getVersion_GMLIB", []() -> std::string {
return GMLIB::Version::getLibVersionString();
});
} }
+1
View File
@@ -3,6 +3,7 @@
#include <RemoteCallAPI.h> #include <RemoteCallAPI.h>
#define PLUGIN_NAME "GMLIB-LRCA" #define PLUGIN_NAME "GMLIB-LRCA"
#define LIB_VERSION SemVersion(0, 8, 4, "", "")
extern ll::Logger logger; extern ll::Logger logger;
+1 -5
View File
@@ -27,11 +27,7 @@ void Export_Legacy_GMLib_ServerAPI() {
return level->setLevelName(name); return level->setLevelName(name);
}); });
RemoteCall::exportAs("GMLib_ServerAPI", "setFakeSeed", [](int64_t seed) -> void { RemoteCall::exportAs("GMLib_ServerAPI", "setFakeSeed", [](int64_t seed) -> void {
auto level = GMLIB_Level::getLevel(); return GMLIB_Level::setFakeSeed(seed);
if (!level) {
return;
}
return level->setFakeSeed(seed);
}); });
RemoteCall::exportAs("GMLib_ServerAPI", "spawnEntity", [](std::pair<Vec3, int> pos, std::string name) -> Actor* { RemoteCall::exportAs("GMLib_ServerAPI", "spawnEntity", [](std::pair<Vec3, int> pos, std::string name) -> Actor* {
return GMLIB_Spawner::spawnEntity(pos.first, pos.second, name); return GMLIB_Spawner::spawnEntity(pos.first, pos.second, name);
+7
View File
@@ -0,0 +1,7 @@
// This file will make your plugin use LeviLamina's memory operators by default.
// This improves the memory management of your plugin and is recommended to use.
// You should not modify anything in this file.
#define LL_MEMORY_OPERATORS
#include <ll/api/memory/MemoryOperators.h>
+1
View File
@@ -12,6 +12,7 @@ Plugin::Plugin(ll::plugin::NativePlugin& self) : mSelf(self) {
Export_Compatibility_API(); Export_Compatibility_API();
ExportPAPI(); ExportPAPI();
logger.info("GMLIB-LegacyRemoteCallApi Loaded!"); logger.info("GMLIB-LegacyRemoteCallApi Loaded!");
logger.info("Version: {}", LIB_VERSION.asString());
logger.info("Author: GroupMountain"); logger.info("Author: GroupMountain");
logger.info("Repository: https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi"); logger.info("Repository: https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi");
} }
+8 -7
View File
@@ -1,21 +1,22 @@
{ {
"format_version": 2, "format_version": 2,
"tooth": "github.com/GroupMountain/GMLIB-LegacyRemoteCallApi", "tooth": "github.com/GroupMountain/GMLIB-LegacyRemoteCallApi",
"version": "0.8.2", "version": "0.8.4",
"info": { "info": {
"name": "GMLIB-LegacyRemoteCallApi", "name": "GMLIB-LegacyRemoteCallApi",
"description": "Legacy RemoteCall API for GMLIB", "description": "Legacy RemoteCall API for GMLIB",
"source": "github.com/GroupMountain/GMLIB-LegacyRemoteCallApi",
"author": "GroupMountain", "author": "GroupMountain",
"tags": [ "tags": [
"LeviLamina", "levilamina",
"GMLIB", "gmlib",
"GMLIB-LegacyRemoteCallApi", "lse",
"Library" "library"
] ]
}, },
"asset_url": "https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi/releases/download/v0.8.2/GMLIB-LegacyRemoteCallApi-windows-x64.zip", "asset_url": "https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi/releases/download/v0.8.4/GMLIB-LegacyRemoteCallApi-windows-x64.zip",
"dependencies": { "dependencies": {
"github.com/GroupMountain/GMLIB": ">=0.8.1" "github.com/GroupMountain/GMLIB": ">=0.8.5"
}, },
"files": { "files": {
"place": [ "place": [