Compare commits

...

5 Commits

6 changed files with 99 additions and 28 deletions
+83 -17
View File
@@ -1,3 +1,6 @@
// 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"),
@@ -319,18 +322,6 @@ class Minecraft {
return GMLIB_API.setWorldSpawn(pos); return GMLIB_API.setWorldSpawn(pos);
} }
static getPlayerSpawnPoint() {
return GMLIB_API.getPlayerSpawnPoint();
}
static setPlayerSpawnPoint(pos) {
GMLIB_API.setPlayerSpawnPoint(pos);
}
static clearPlayerSpawnPoint() {
GMLIB_API.clearPlayerSpawnPoint();
}
static setEducationFeatureEnabled() { static setEducationFeatureEnabled() {
return GMLIB_API.setEducationFeatureEnabled(); return GMLIB_API.setEducationFeatureEnabled();
} }
@@ -367,10 +358,6 @@ class Minecraft {
return GMLIB_API.setUnknownBlockCleaner(); return GMLIB_API.setUnknownBlockCleaner();
} }
static playerToEntity(player) {
return GMLIB_API.PlayerToEntity(player);
}
static spawnEntity(pos, name) { static spawnEntity(pos, name) {
return GMLIB_API.spawnEntity(pos, name); return GMLIB_API.spawnEntity(pos, name);
} }
@@ -480,6 +467,53 @@ class Experiments {
} }
} }
class Version {
constructor(major, minor, patch) {
this.mMajor = major;
this.mMinor = minor;
this.mPatch = patch;
}
toString(prefix = true) {
let result = `${this.mMajor}.${this.mMinor}.${this.mPatch}`;
if (prefix) {
result = "v" + result;
}
return result;
}
toArray() {
return [this.mMajor, this.mMinor, this.mPatch];
}
valueOf() {
return 100000000 * this.mMajor + 10000 * this.mMinor + this.mPatch;
}
static fromString(string) {
if (typeof string === 'string' || string instanceof String) {
let pattern = /^v?\d+\.\d+\.\d+$/;
if (pattern.test(string)) {
let regex = /\d+/g;
let numbers = string.match(regex);
let array = numbers.slice(0, 3).map(Number);
return new Version(array[0], array[1], array[2]);
}
}
return null;
}
static fromArray(array) {
if (Array.isArray(array) && array.length == 3) {
let isNumber = array.every(element => typeof element == "number");
if (isNumber) {
return new Version(array[0], array[1], array[2])
}
}
return null;
}
}
class GMLIB { class GMLIB {
constructor() { constructor() {
throw new Error("Static class cannot be instantiated"); throw new Error("Static class cannot be instantiated");
@@ -772,6 +806,31 @@ class JsonI18n {
} }
}; };
LLSE_Player.prototype.toEntity = function () {
return GMLIB_API.PlayerToEntity(this);
}
LLSE_Player.prototype.getSpawnPoint = function () {
return GMLIB_API.getPlayerSpawnPoint(this);
}
LLSE_Player.prototype.setSpawnPoint = function (pos) {
return GMLIB_API.setPlayerSpawnPoint(this, pos);
}
LLSE_Player.prototype.clearSpawnPoint = function () {
return GMLIB_API.clearPlayerSpawnPoint(this);
}
LLSE_Entity.prototype.shootProjectile = function (proj, speed = 2, offset = 3) {
return GMLIB_API.shootProjectile(this, proj, speed, offset);
}
LLSE_Entity.prototype.throwEntity = function (proj, speed = 2, offset = 3) {
return GMLIB_API.throwEntity(this, proj, speed, offset);
}
module.exports = { module.exports = {
StaticFloatingText, StaticFloatingText,
DynamicFloatingText, DynamicFloatingText,
@@ -782,5 +841,12 @@ module.exports = {
Scoreboard, Scoreboard,
JsonConfig, JsonConfig,
JsonLanguage, JsonLanguage,
JsonI18n JsonI18n,
Version
}; };
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "${pluginName}", "name": "${pluginName}",
"entry": "${pluginFile}", "entry": "${pluginFile}",
"version": "0.9.5", "version": "0.10.1",
"author": "GroupMountain", "author": "GroupMountain",
"type": "native", "type": "native",
"dependencies": [ "dependencies": [
+7 -2
View File
@@ -158,8 +158,8 @@ void Export_Compatibility_API() {
return false; return false;
}); });
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 = SemVersion(a, b, c, "", ""); auto version = GMLIB::Version(a, b, c, "", "");
return LIB_VERSION.satisfies(version); return version >= LIB_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 {
@@ -171,10 +171,15 @@ void Export_Compatibility_API() {
[](std::string key, std::vector<std::string> params) -> std::string { return I18n::get(key, params); } [](std::string key, std::vector<std::string> params) -> std::string { return I18n::get(key, params); }
); );
RemoteCall::exportAs("GMLIB_API", "chooseResourcePackI18nLanguage", [](std::string code) -> void { RemoteCall::exportAs("GMLIB_API", "chooseResourcePackI18nLanguage", [](std::string code) -> void {
if (GMLIB_Level::getInstance()) {
I18n::chooseLanguage(code); I18n::chooseLanguage(code);
}
}); });
RemoteCall::exportAs("GMLIB_API", "getResourcePackI18nLanguage", []() -> std::string { RemoteCall::exportAs("GMLIB_API", "getResourcePackI18nLanguage", []() -> std::string {
if (GMLIB_Level::getInstance()) {
return I18n::getCurrentLanguage()->getFullLanguageCode(); return I18n::getCurrentLanguage()->getFullLanguageCode();
}
return "unknown";
}); });
RemoteCall::exportAs("GMLIB_API", "getPlayerPosition", [](std::string uuid) -> std::pair<BlockPos, int> { RemoteCall::exportAs("GMLIB_API", "getPlayerPosition", [](std::string uuid) -> std::pair<BlockPos, int> {
auto uid = mce::UUID::fromString(uuid); auto uid = mce::UUID::fromString(uuid);
+1 -1
View File
@@ -4,7 +4,7 @@
#include <RemoteCallAPI.h> #include <RemoteCallAPI.h>
#define PLUGIN_NAME "GMLIB-LRCA" #define PLUGIN_NAME "GMLIB-LRCA"
#define LIB_VERSION SemVersion(0, 9, 4, "", "") #define LIB_VERSION GMLIB::Version(0, 10, 1)
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.9.5", "version": "0.10.1",
"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.9.5/GMLIB-LegacyRemoteCallApi-windows-x64.zip", "asset_url": "https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi/releases/download/v0.10.1/GMLIB-LegacyRemoteCallApi-windows-x64.zip",
"dependencies": { "dependencies": {
"github.com/GroupMountain/GMLIB": ">=0.9.8" "github.com/GroupMountain/GMLIB": ">=0.10.0"
}, },
"files": { "files": {
"place": [ "place": [