Compare commits

..

3 Commits

10 changed files with 47 additions and 100 deletions
+35 -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 = {
createFloatingText: ll.import("GMLIB_API", "createFloatingText"),
deleteFloatingText: ll.import("GMLIB_API", "deleteFloatingText"),
@@ -319,18 +322,6 @@ class Minecraft {
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() {
return GMLIB_API.setEducationFeatureEnabled();
}
@@ -367,10 +358,6 @@ class Minecraft {
return GMLIB_API.setUnknownBlockCleaner();
}
static playerToEntity(player) {
return GMLIB_API.PlayerToEntity(player);
}
static spawnEntity(pos, name) {
return GMLIB_API.spawnEntity(pos, name);
}
@@ -819,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 = {
StaticFloatingText,
DynamicFloatingText,
@@ -831,4 +843,10 @@ module.exports = {
JsonLanguage,
JsonI18n,
Version
};
};
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "${pluginName}",
"entry": "${pluginFile}",
"version": "0.10.0",
"version": "0.10.1",
"author": "GroupMountain",
"type": "native",
"dependencies": [
+7 -2
View File
@@ -171,10 +171,15 @@ void Export_Compatibility_API() {
[](std::string key, std::vector<std::string> params) -> std::string { return I18n::get(key, params); }
);
RemoteCall::exportAs("GMLIB_API", "chooseResourcePackI18nLanguage", [](std::string code) -> void {
I18n::chooseLanguage(code);
if (GMLIB_Level::getInstance()) {
I18n::chooseLanguage(code);
}
});
RemoteCall::exportAs("GMLIB_API", "getResourcePackI18nLanguage", []() -> std::string {
return I18n::getCurrentLanguage()->getFullLanguageCode();
if (GMLIB_Level::getInstance()) {
return I18n::getCurrentLanguage()->getFullLanguageCode();
}
return "unknown";
});
RemoteCall::exportAs("GMLIB_API", "getPlayerPosition", [](std::string uuid) -> std::pair<BlockPos, int> {
auto uid = mce::UUID::fromString(uuid);
+1 -1
View File
@@ -4,7 +4,7 @@
#include <RemoteCallAPI.h>
#define PLUGIN_NAME "GMLIB-LRCA"
#define LIB_VERSION GMLIB::Version(0, 10, 0)
#define LIB_VERSION GMLIB::Version(0, 10, 1)
extern ll::Logger logger;
@@ -1,53 +0,0 @@
/**
*
* @name GMLIB_LRCA-Plugin-Template
* @brief plugin template for GMLIB-LegacyRemoteCallApi
*
* @copyright Copyright (c) 2024 GroupMountain
* GMLIB-LegacyRemoteCallApi <https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi/>
*
*/
const PluginInfo = {
Name: "GMLIB_LRCA-Plugin-Template",
Author: "your name",
Version: "0.0.1"
}
// 导入 API
const { JsonConfig, JsonI18n } = require('./GMLIB-LegacyRemoteCallApi/lib/GMLIB_API-JS');
// 默认配置文件
const defaultConfig = {
"language": "zh_CN"
};
// 默认语言文件
const zh_CN = {
"consolelog.loaded": "加载成功!",
"consolelog.info": "插件作者: {1}, 当前版本: v{2}"
};
// 初始化配置文件
const config = new JsonConfig(`./plugins/${PluginInfo.Name}/config/config.json`, defaultConfig);
// 初始化 I18n
const I18n = new JsonI18n(`./plugins/${PluginInfo.Name}/language/`, config.get("language"));
I18n.loadLanguage("zh_CN", zh_CN); // 升级语言文件
I18n.setDefaultLanguage("zh_CN"); // 设置I18n无法翻译时采用的默认语言
// I18n快捷翻译函数
function tr(key, data = []) {
return I18n.translate(key, data);
}
// 监听服务器启动
// 在无特殊说明的情况下,一切 MCAPI 都应该在服务器启动后访问。
mc.listen("onServerStarted", () => {
// 你的代码
// 打印插件信息
logger.info(tr("consolelog.loaded"));
logger.info(tr("consolelog.info", [PluginInfo.Author, PluginInfo.Version]));
});
@@ -1,3 +0,0 @@
{
"language": "zh_CN"
}
@@ -1,4 +0,0 @@
{
"consolelog.loaded": "加载成功!",
"consolelog.info": "插件作者: {1}, 当前版本: v{2}"
}
@@ -1,16 +0,0 @@
{
"entry": "GMLIB_LRCA-Plugin-Template.js",
"name": "GMLIB_LRCA-Plugin-Template",
"type": "lse-quickjs",
"version": "0.0.1",
"author": "Your Name",
"description": "plugin description",
"dependencies": [
{
"name": "legacy-script-engine-quickjs"
},
{
"name": "GMLIB-LegacyRemoteCallApi"
}
]
}
+2 -2
View File
@@ -1,7 +1,7 @@
{
"format_version": 2,
"tooth": "github.com/GroupMountain/GMLIB-LegacyRemoteCallApi",
"version": "0.10.0",
"version": "0.10.1",
"info": {
"name": "GMLIB-LegacyRemoteCallApi",
"description": "Legacy RemoteCall API for GMLIB",
@@ -14,7 +14,7 @@
"library"
]
},
"asset_url": "https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi/releases/download/v0.10.0/GMLIB-LegacyRemoteCallApi-windows-x64.zip",
"asset_url": "https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi/releases/download/v0.10.1/GMLIB-LegacyRemoteCallApi-windows-x64.zip",
"dependencies": {
"github.com/GroupMountain/GMLIB": ">=0.10.0"
},