Compare commits

..

7 Commits

15 changed files with 346 additions and 308 deletions
+2
View File
@@ -11,6 +11,8 @@ jobs:
uses: actions/checkout@v2 uses: actions/checkout@v2
- uses: xmake-io/github-action-setup-xmake@v1 - uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: 2.9.9
- run: | - run: |
xmake repo -u xmake repo -u
+2
View File
@@ -11,6 +11,8 @@ jobs:
uses: actions/checkout@v2 uses: actions/checkout@v2
- uses: xmake-io/github-action-setup-xmake@v1 - uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: 2.9.9
- run: | - run: |
xmake repo -u xmake repo -u
+9 -9
View File
@@ -1,22 +1,22 @@
const PlaceholderAPI = { const PlaceholderAPI = {
/** 获取一个服务器变量的值 @type {function(string):string} */ /** 获取一个服务器变量的值 @type {function(string):string} */
getValueAPI: ll.import("BEPlaceholderAPI", "GetValue"), getValueAPI: ll.imports("BEPlaceholderAPI", "GetValue"),
/** 获取一个玩家变量的值 @type {function(string,Player):string} */ /** 获取一个玩家变量的值 @type {function(string,Player):string} */
getValueByPlayerAPI: ll.import("BEPlaceholderAPI", "GetValueWithPlayer"), getValueByPlayerAPI: ll.imports("BEPlaceholderAPI", "GetValueWithPlayer"),
/** 注册一个玩家变量 @type {function(string,string,string):boolean} */ /** 注册一个玩家变量 @type {function(string,string,string):boolean} */
registerPlayerPlaceholderAPI: ll.import("BEPlaceholderAPI", "registerPlayerPlaceholder"), registerPlayerPlaceholderAPI: ll.imports("BEPlaceholderAPI", "registerPlayerPlaceholder"),
/** 注册一个服务器变量 @type {function(string,string,string):boolean} */ /** 注册一个服务器变量 @type {function(string,string,string):boolean} */
registerServerPlaceholderAPI: ll.import("BEPlaceholderAPI", "registerServerPlaceholder"), registerServerPlaceholderAPI: ll.imports("BEPlaceholderAPI", "registerServerPlaceholder"),
/** 注册一个静态变量 @type {function(string,string,string,number):boolean} */ /** 注册一个静态变量 @type {function(string,string,string,number):boolean} */
registerStaticPlaceholderAPI: ll.import("BEPlaceholderAPI", "registerStaticPlaceholder"), registerStaticPlaceholderAPI: ll.imports("BEPlaceholderAPI", "registerStaticPlaceholder"),
/** 翻译包含PAPI服务器变量的字符串 @type {function(string):string} */ /** 翻译包含PAPI服务器变量的字符串 @type {function(string):string} */
translateStringAPI: ll.import("BEPlaceholderAPI", "translateString"), translateStringAPI: ll.imports("BEPlaceholderAPI", "translateString"),
/** 翻译包含PAPI玩家变量的字符串 @type {function(string,Player):string} */ /** 翻译包含PAPI玩家变量的字符串 @type {function(string,Player):string} */
translateStringWithPlayerAPI: ll.import("BEPlaceholderAPI", "translateStringWithPlayer"), translateStringWithPlayerAPI: ll.imports("BEPlaceholderAPI", "translateStringWithPlayer"),
/** 注销PAPI变量 @type {function(string):boolean} */ /** 注销PAPI变量 @type {function(string):boolean} */
unRegisterPlaceholderAPI: ll.import("BEPlaceholderAPI", "unRegisterPlaceholder"), unRegisterPlaceholderAPI: ll.imports("BEPlaceholderAPI", "unRegisterPlaceholder"),
/** 获取所有已注册的PAPI变量 @type {function():Array.<string>} */ /** 获取所有已注册的PAPI变量 @type {function():Array.<string>} */
getAllPAPI: ll.import("BEPlaceholderAPI", "getAllPAPI") getAllPAPI: ll.imports("BEPlaceholderAPI", "getAllPAPI")
} }
Function.prototype.getName = Function.prototype.getName =
+4 -4
View File
@@ -116,7 +116,7 @@ module.exports = {
*/ */
emplaceListener: function (eventName, callback, priority = this.EventPriority.Normal, pluginName = getPluginName()) { emplaceListener: function (eventName, callback, priority = this.EventPriority.Normal, pluginName = getPluginName()) {
if (typeof callback !== "function") throw new Error("callback must be a function!"); if (typeof callback !== "function") throw new Error("callback must be a function!");
const /** @type {number} */ eventId = ll.imports("GMLIB_Event_API", "emplaceListener")(pluginName, eventName, priority); const /** @type {number} */ eventId = ll.importss("GMLIB_Event_API", "emplaceListener")(pluginName, eventName, priority);
if (eventId === -1) throw new Error(`Event ${eventName} creation failed!`); if (eventId === -1) throw new Error(`Event ${eventName} creation failed!`);
ll.exports((...data) => { ll.exports((...data) => {
let /** @type {boolean} */ result = typeof (data.slice(-1)[0]) === "boolean" ? data.pop() : false; let /** @type {boolean} */ result = typeof (data.slice(-1)[0]) === "boolean" ? data.pop() : false;
@@ -146,7 +146,7 @@ module.exports = {
* @param {boolean} * @param {boolean}
*/ */
removeListener: function (eventId) { removeListener: function (eventId) {
const result = ll.imports("GMLIB_Event_API", "removeListener")(eventId); const result = ll.importss("GMLIB_Event_API", "removeListener")(eventId);
if (result) { if (result) {
for (let [eventName, eventIds] of Object.entries(this.mEventData)) { for (let [eventName, eventIds] of Object.entries(this.mEventData)) {
this.mEventData[eventName] = eventIds.filter(id => id !== eventId); this.mEventData[eventName] = eventIds.filter(id => id !== eventId);
@@ -162,7 +162,7 @@ module.exports = {
* @returns {boolean} * @returns {boolean}
*/ */
hasListener: function (eventId) { hasListener: function (eventId) {
return ll.imports("GMLIB_Event_API", "hasListener")(eventId); return ll.importss("GMLIB_Event_API", "hasListener")(eventId);
}, },
/** /**
@@ -171,7 +171,7 @@ module.exports = {
* @returns {number?} * @returns {number?}
*/ */
getListenerPriority: function (eventId) { getListenerPriority: function (eventId) {
const priority = ll.imports("GMLIB_Event_API", "getListenerPriority")(eventId); const priority = ll.importss("GMLIB_Event_API", "getListenerPriority")(eventId);
return priority === -1 ? undefined : priority; return priority === -1 ? undefined : priority;
}, },
+24 -24
View File
@@ -1,4 +1,4 @@
// // const getNextCallbackId = ll.import("GMLIB_FormAPI", "getNextFormCallbackId"); // // const getNextCallbackId = ll.imports("GMLIB_FormAPI", "getNextFormCallbackId");
// class ServerSettingForm { // class ServerSettingForm {
// constructor() { // constructor() {
@@ -6,35 +6,35 @@
// } // }
// static getDefaultPriority() { // static getDefaultPriority() {
// return ll.import("GMLIB_ServerSettingForm", "getDefaultPriority")(); // return ll.imports("GMLIB_ServerSettingForm", "getDefaultPriority")();
// } // }
// static hasTitle() { // static hasTitle() {
// return ll.import("GMLIB_ServerSettingForm", "hasTitle")(); // return ll.imports("GMLIB_ServerSettingForm", "hasTitle")();
// } // }
// static getTitle() { // static getTitle() {
// return ll.import("GMLIB_ServerSettingForm", "getTitle")(); // return ll.imports("GMLIB_ServerSettingForm", "getTitle")();
// } // }
// static setTitle(title, forceModify = false) { // static setTitle(title, forceModify = false) {
// return ll.import("GMLIB_ServerSettingForm", "setTitle")(title, forceModify); // return ll.imports("GMLIB_ServerSettingForm", "setTitle")(title, forceModify);
// } // }
// static hasIcon() { // static hasIcon() {
// return ll.import("GMLIB_ServerSettingForm", "hasIcon")(); // return ll.imports("GMLIB_ServerSettingForm", "hasIcon")();
// } // }
// static getIconData() { // static getIconData() {
// return hasIcon() ? ll.import("GMLIB_ServerSettingForm", "getIconData")() : null; // return hasIcon() ? ll.imports("GMLIB_ServerSettingForm", "getIconData")() : null;
// } // }
// static getIconType() { // static getIconType() {
// return ll.import("GMLIB_ServerSettingForm", "getIconType")(); // return ll.imports("GMLIB_ServerSettingForm", "getIconType")();
// } // }
// static setIcon(data, type = 0, forceModify = false) { // static setIcon(data, type = 0, forceModify = false) {
// return ll.import("GMLIB_ServerSettingForm", "setIcon")(data, type, forceModify); // return ll.imports("GMLIB_ServerSettingForm", "setIcon")(data, type, forceModify);
// } // }
// static addLabel( // static addLabel(
@@ -44,7 +44,7 @@
// ) { // ) {
// let detectorId = getNextCallbackId(); // let detectorId = getNextCallbackId();
// ll.export(playerDetector, "GMLIB_FORM_CALLBACK", detectorId); // ll.export(playerDetector, "GMLIB_FORM_CALLBACK", detectorId);
// return ll.import("GMLIB_ServerSettingForm", "addLabel")(text, detectorId, priority); // return ll.imports("GMLIB_ServerSettingForm", "addLabel")(text, detectorId, priority);
// } // }
@@ -60,7 +60,7 @@
// ll.export(callback, "GMLIB_FORM_CALLBACK", callbackId); // ll.export(callback, "GMLIB_FORM_CALLBACK", callbackId);
// let detectorId = getNextCallbackId(); // let detectorId = getNextCallbackId();
// ll.export(playerDetector, "GMLIB_FORM_CALLBACK", detectorId); // ll.export(playerDetector, "GMLIB_FORM_CALLBACK", detectorId);
// return ll.import("GMLIB_ServerSettingForm", "addInput")(text, placeholder, defaultVal, callbackId, detectorId, priority); // return ll.imports("GMLIB_ServerSettingForm", "addInput")(text, placeholder, defaultVal, callbackId, detectorId, priority);
// } // }
// static addToggle( // static addToggle(
@@ -74,7 +74,7 @@
// ll.export(callback, "GMLIB_FORM_CALLBACK", callbackId); // ll.export(callback, "GMLIB_FORM_CALLBACK", callbackId);
// let detectorId = getNextCallbackId(); // let detectorId = getNextCallbackId();
// ll.export(playerDetector, "GMLIB_FORM_CALLBACK", detectorId); // ll.export(playerDetector, "GMLIB_FORM_CALLBACK", detectorId);
// return ll.import("GMLIB_ServerSettingForm", "addToggle")(text, defaultVal, callbackId, detectorId, priority); // return ll.imports("GMLIB_ServerSettingForm", "addToggle")(text, defaultVal, callbackId, detectorId, priority);
// } // }
// static addDropdown( // static addDropdown(
@@ -89,7 +89,7 @@
// ll.export(callback, "GMLIB_FORM_CALLBACK", callbackId); // ll.export(callback, "GMLIB_FORM_CALLBACK", callbackId);
// let detectorId = getNextCallbackId(); // let detectorId = getNextCallbackId();
// ll.export(playerDetector, "GMLIB_FORM_CALLBACK", detectorId); // ll.export(playerDetector, "GMLIB_FORM_CALLBACK", detectorId);
// return ll.import("GMLIB_ServerSettingForm", "addDropdown")(text, options, defaultVal, callbackId, detectorId, priority); // return ll.imports("GMLIB_ServerSettingForm", "addDropdown")(text, options, defaultVal, callbackId, detectorId, priority);
// } // }
// static addSlider( // static addSlider(
@@ -106,7 +106,7 @@
// ll.export(callback, "GMLIB_FORM_CALLBACK", callbackId); // ll.export(callback, "GMLIB_FORM_CALLBACK", callbackId);
// let detectorId = getNextCallbackId(); // let detectorId = getNextCallbackId();
// ll.export(playerDetector, "GMLIB_FORM_CALLBACK", detectorId); // ll.export(playerDetector, "GMLIB_FORM_CALLBACK", detectorId);
// return ll.import("GMLIB_ServerSettingForm", "addSlider")(text, min, max, step, defaultVal, callbackId, detectorId, priority); // return ll.imports("GMLIB_ServerSettingForm", "addSlider")(text, min, max, step, defaultVal, callbackId, detectorId, priority);
// } // }
// static addStepSlider( // static addStepSlider(
@@ -121,57 +121,57 @@
// ll.export(callback, "GMLIB_FORM_CALLBACK", callbackId); // ll.export(callback, "GMLIB_FORM_CALLBACK", callbackId);
// let detectorId = getNextCallbackId(); // let detectorId = getNextCallbackId();
// ll.export(playerDetector, "GMLIB_FORM_CALLBACK", detectorId); // ll.export(playerDetector, "GMLIB_FORM_CALLBACK", detectorId);
// return ll.import("GMLIB_ServerSettingForm", "addStepSlider")(text, steps, defaultVal, callbackId, detectorId, priority); // return ll.imports("GMLIB_ServerSettingForm", "addStepSlider")(text, steps, defaultVal, callbackId, detectorId, priority);
// } // }
// static removeElement(id) { // static removeElement(id) {
// return ll.import("GMLIB_ServerSettingForm", "removeElement")(id); // return ll.imports("GMLIB_ServerSettingForm", "removeElement")(id);
// } // }
// } // }
// class NpcDialogueForm { // class NpcDialogueForm {
// constructor(npcName, sceneName, dialogue) { // constructor(npcName, sceneName, dialogue) {
// this.mFormId = ll.import("GMLIB_NpcDialogueForm", "createForm")(npcName, sceneName, dialogue); // this.mFormId = ll.imports("GMLIB_NpcDialogueForm", "createForm")(npcName, sceneName, dialogue);
// } // }
// addButton(button) { // addButton(button) {
// return ll.import("GMLIB_NpcDialogueForm", "addButton")(this.mFormId, button); // return ll.imports("GMLIB_NpcDialogueForm", "addButton")(this.mFormId, button);
// } // }
// sendTo(pl, callback = (pl, index, type) => { }, free = true) { // sendTo(pl, callback = (pl, index, type) => { }, free = true) {
// let callbackId = getNextCallbackId(); // let callbackId = getNextCallbackId();
// ll.export(callback, "GMLIB_FORM_CALLBACK", callbackId); // ll.export(callback, "GMLIB_FORM_CALLBACK", callbackId);
// ll.import("GMLIB_NpcDialogueForm", "sendTo")(this.mFormId, pl, callbackId); // ll.imports("GMLIB_NpcDialogueForm", "sendTo")(this.mFormId, pl, callbackId);
// if (free) { // if (free) {
// this.destroy(); // this.destroy();
// } // }
// } // }
// destroy() { // destroy() {
// ll.import("GMLIB_NpcDialogueForm", "destroyForm")(this.mFormId); // ll.imports("GMLIB_NpcDialogueForm", "destroyForm")(this.mFormId);
// } // }
// } // }
// class ChestForm { // class ChestForm {
// constructor(npcName, sceneName, dialogue) { // constructor(npcName, sceneName, dialogue) {
// this.mFormId = ll.import("GMLIB_NpcDialogueForm", "createForm")(npcName, sceneName, dialogue); // this.mFormId = ll.imports("GMLIB_NpcDialogueForm", "createForm")(npcName, sceneName, dialogue);
// } // }
// addButton(button) { // addButton(button) {
// return ll.import("GMLIB_NpcDialogueForm", "addButton")(this.mFormId, button); // return ll.imports("GMLIB_NpcDialogueForm", "addButton")(this.mFormId, button);
// } // }
// sendTo(pl, free = true) { // sendTo(pl, free = true) {
// //let callbackId = getNextCallbackId(); // //let callbackId = getNextCallbackId();
// //ll.export(callback, "GMLIB_FORM_CALLBACK", callbackId); // //ll.export(callback, "GMLIB_FORM_CALLBACK", callbackId);
// //ll.import("GMLIB_NpcDialogueForm", "sendTo")(this.mFormId, pl, callbackId); // //ll.imports("GMLIB_NpcDialogueForm", "sendTo")(this.mFormId, pl, callbackId);
// //if (free) { // //if (free) {
// // this.destroy(); // // this.destroy();
// //} // //}
// } // }
// destroy() { // destroy() {
// //ll.import("GMLIB_NpcDialogueForm", "destroyForm")(this.mFormId); // //ll.imports("GMLIB_NpcDialogueForm", "destroyForm")(this.mFormId);
// } // }
// } // }
+3
View File
@@ -1556,6 +1556,9 @@ interface Player {
slot: number slot: number
): Item; ): Item;
/** (GMLIB & Glacie)获取客户端版本协议*/
getNetworkProtocolVersion(): number
/** (GMLIB)发送更新更新物品数据包 */ /** (GMLIB)发送更新更新物品数据包 */
sendInventorySlotPacket( sendInventorySlotPacket(
/** 容器ID */ /** 容器ID */
+225 -214
View File
@@ -1,437 +1,439 @@
/** LRCA导出接口 */ /** LRCA导出接口 */
const GMLIB_API = { const GMLIB_API = {
/** 创建悬浮字 @type {function(FloatPos,string,boolean):number} */ /** 创建悬浮字 @type {function(FloatPos,string,boolean):number} */
createFloatingText: ll.import("GMLIB_API", "createFloatingText"), createFloatingText: ll.imports("GMLIB_API", "createFloatingText"),
/** 删除悬浮字 @type {function(number):boolean} */ /** 删除悬浮字 @type {function(number):boolean} */
deleteFloatingText: ll.import("GMLIB_API", "deleteFloatingText"), deleteFloatingText: ll.imports("GMLIB_API", "deleteFloatingText"),
/** 设置悬浮字文本 @type {function(number,string):boolean} */ /** 设置悬浮字文本 @type {function(number,string):boolean} */
setFloatingTextData: ll.import("GMLIB_API", "setFloatingTextData"), setFloatingTextData: ll.imports("GMLIB_API", "setFloatingTextData"),
/** 发送悬浮字给玩家 @type {function(number,Player):boolean} */ /** 发送悬浮字给玩家 @type {function(number,Player):boolean} */
sendFloatingTextToPlayer: ll.import("GMLIB_API", "sendFloatingTextToPlayer"), sendFloatingTextToPlayer: ll.imports("GMLIB_API", "sendFloatingTextToPlayer"),
/** 发送悬浮字给所有玩家 @type {function(number):boolean} */ /** 发送悬浮字给所有玩家 @type {function(number):boolean} */
sendFloatingText: ll.import("GMLIB_API", "sendFloatingText"), sendFloatingText: ll.imports("GMLIB_API", "sendFloatingText"),
/** 删除玩家的悬浮字 @type {function(number,Player):boolean} */ /** 删除玩家的悬浮字 @type {function(number,Player):boolean} */
removeFloatingTextFromPlayer: ll.import("GMLIB_API", "removeFloatingTextFromPlayer"), removeFloatingTextFromPlayer: ll.imports("GMLIB_API", "removeFloatingTextFromPlayer"),
/** 删除所有玩家悬浮字 @type {function(number):boolean} */ /** 删除所有玩家悬浮字 @type {function(number):boolean} */
removeFloatingText: ll.import("GMLIB_API", "removeFloatingText"), removeFloatingText: ll.imports("GMLIB_API", "removeFloatingText"),
/** 更新玩家的悬浮字 @type {function(number,Player):boolean} */ /** 更新玩家的悬浮字 @type {function(number,Player):boolean} */
updateClientFloatingTextData: ll.import("GMLIB_API", "updateClientFloatingTextData"), updateClientFloatingTextData: ll.imports("GMLIB_API", "updateClientFloatingTextData"),
/** 更新所有玩家的悬浮字 @type {function(number):boolean} */ /** 更新所有玩家的悬浮字 @type {function(number):boolean} */
updateAllClientsFloatingTextData: ll.import("GMLIB_API", "updateAllClientsFloatingTextData"), updateAllClientsFloatingTextData: ll.imports("GMLIB_API", "updateAllClientsFloatingTextData"),
/** 获取服务器Mspt @type {function():number} */ /** 获取服务器Mspt @type {function():number} */
getServerMspt: ll.import("GMLIB_API", "getServerMspt"), getServerMspt: ll.imports("GMLIB_API", "getServerMspt"),
/** 获取服务器当前tps @type {function():number} */ /** 获取服务器当前tps @type {function():number} */
getServerCurrentTps: ll.import("GMLIB_API", "getServerCurrentTps"), getServerCurrentTps: ll.imports("GMLIB_API", "getServerCurrentTps"),
/** 获取服务器平均tps @type {function():number} */ /** 获取服务器平均tps @type {function():number} */
getServerAverageTps: ll.import("GMLIB_API", "getServerAverageTps"), getServerAverageTps: ll.imports("GMLIB_API", "getServerAverageTps"),
/** 获取存档内所有玩家的uuid @type {function():Array<string>} */ /** 获取存档内所有玩家的uuid @type {function():Array<string>} */
getAllPlayerUuids: ll.import("GMLIB_API", "getAllPlayerUuids"), getAllPlayerUuids: ll.imports("GMLIB_API", "getAllPlayerUuids"),
/** 获取玩家NBT @type {function(string):NbtCompound} */ /** 获取玩家NBT @type {function(string):NbtCompound} */
getPlayerNbt: ll.import("GMLIB_API", "getPlayerNbt"), getPlayerNbt: ll.imports("GMLIB_API", "getPlayerNbt"),
/** 设置玩家NBT @type {function(string,NbtCompound,boolean):boolean} */ /** 设置玩家NBT @type {function(string,NbtCompound,boolean):boolean} */
setPlayerNbt: ll.import("GMLIB_API", "setPlayerNbt"), setPlayerNbt: ll.imports("GMLIB_API", "setPlayerNbt"),
/** 覆盖玩家的特定nbtTags @type {function(string,NbtCompound,Array.<string>):boolean} */ /** 覆盖玩家的特定nbtTags @type {function(string,NbtCompound,Array.<string>):boolean} */
setPlayerNbtTags: ll.import("GMLIB_API", "setPlayerNbtTags"), setPlayerNbtTags: ll.imports("GMLIB_API", "setPlayerNbtTags"),
/** 删除玩家所有的NBT @type {function(string):boolean} */ /** 删除玩家所有的NBT @type {function(string):boolean} */
deletePlayerNbt: ll.import("GMLIB_API", "deletePlayerNbt"), deletePlayerNbt: ll.imports("GMLIB_API", "deletePlayerNbt"),
/** 使用特定语言翻译资源包文本 @type {function(string,Array.<string>,string):string} */ /** 使用特定语言翻译资源包文本 @type {function(string,Array.<string>,string):string} */
resourcePackTranslate: ll.import("GMLIB_API", "resourcePackTranslate"), resourcePackTranslate: ll.imports("GMLIB_API", "resourcePackTranslate"),
/** 使用默认语言翻译资源包文本 @type {function(string,Array.<string>):string} */ /** 使用默认语言翻译资源包文本 @type {function(string,Array.<string>):string} */
resourcePackDefaultTranslate: ll.import("GMLIB_API", "resourcePackDefaultTranslate"), resourcePackDefaultTranslate: ll.imports("GMLIB_API", "resourcePackDefaultTranslate"),
/** 获取资源包默认语言 @type {function():string} */ /** 获取资源包默认语言 @type {function():string} */
getResourcePackI18nLanguage: ll.import("GMLIB_API", "getResourcePackI18nLanguage"), getResourcePackI18nLanguage: ll.imports("GMLIB_API", "getResourcePackI18nLanguage"),
/** 设置资源包默认语言 @type {function(string):void} */ /** 设置资源包默认语言 @type {function(string):void} */
chooseResourcePackI18nLanguage: ll.import("GMLIB_API", "chooseResourcePackI18nLanguage"), chooseResourcePackI18nLanguage: ll.imports("GMLIB_API", "chooseResourcePackI18nLanguage"),
/** 启用教育版内容 @type {function():void} */ /** 启用教育版内容 @type {function():void} */
setEducationFeatureEnabled: ll.import("GMLib_ServerAPI", "setEducationFeatureEnabled"), setEducationFeatureEnabled: ll.imports("GMLib_ServerAPI", "setEducationFeatureEnabled"),
/** 注册Ability命令 @type {function():void} */ /** 注册Ability命令 @type {function():void} */
registerAbilityCommand: ll.import("GMLib_ServerAPI", "registerAbilityCommand"), registerAbilityCommand: ll.imports("GMLib_ServerAPI", "registerAbilityCommand"),
/** 启用Xbox成就 @type {function():void} */ /** 启用Xbox成就 @type {function():void} */
setEnableAchievement: ll.import("GMLib_ServerAPI", "setEnableAchievement"), setEnableAchievement: ll.imports("GMLib_ServerAPI", "setEnableAchievement"),
/** 信任所有玩家皮肤 @type {function():void} */ /** 信任所有玩家皮肤 @type {function():void} */
setForceTrustSkins: ll.import("GMLib_ServerAPI", "setForceTrustSkins"), setForceTrustSkins: ll.imports("GMLib_ServerAPI", "setForceTrustSkins"),
/** 资源包双端共存 @type {function():void} */ /** 资源包双端共存 @type {function():void} */
enableCoResourcePack: ll.import("GMLib_ServerAPI", "enableCoResourcePack"), enableCoResourcePack: ll.imports("GMLib_ServerAPI", "enableCoResourcePack"),
/** 获取存档名字 @type {function():string} */ /** 获取存档名字 @type {function():string} */
getLevelName: ll.import("GMLib_ServerAPI", "getLevelName"), getLevelName: ll.imports("GMLib_ServerAPI", "getLevelName"),
/** 设置存档名字 @type {function(string):boolean} */ /** 设置存档名字 @type {function(string):boolean} */
setLevelName: ll.import("GMLib_ServerAPI", "setLevelName"), setLevelName: ll.imports("GMLib_ServerAPI", "setLevelName"),
/** 设置假种子 @type {function(number):void} */ /** 设置假种子 @type {function(number):void} */
setFakeSeed: ll.import("GMLib_ServerAPI", "setFakeSeed"), setFakeSeed: ll.imports("GMLib_ServerAPI", "setFakeSeed"),
/** 强制生成实体 @type {function(FloatPos,string):Entity} */ /** 强制生成实体 @type {function(FloatPos,string):Entity} */
spawnEntity: ll.import("GMLib_ServerAPI", "spawnEntity"), spawnEntity: ll.imports("GMLib_ServerAPI", "spawnEntity"),
/** 射弹投射物 @type {function(Entity,string,number,number):boolean} */ /** 射弹投射物 @type {function(Entity,string,number,number):boolean} */
shootProjectile: ll.import("GMLib_ServerAPI", "shootProjectile"), shootProjectile: ll.imports("GMLib_ServerAPI", "shootProjectile"),
/** 投掷实体 @type {function(Entity,Entity,number,number):boolean} */ /** 投掷实体 @type {function(Entity,Entity,number,number):boolean} */
throwEntity: ll.import("GMLib_ServerAPI", "throwEntity"), throwEntity: ll.imports("GMLib_ServerAPI", "throwEntity"),
/** 根据玩家对象获取实体对象 @type {function(Player):Entity} */ /** 根据玩家对象获取实体对象 @type {function(Player):Entity} */
PlayerToEntity: ll.import("GMLib_ServerAPI", "PlayerToEntity"), PlayerToEntity: ll.imports("GMLib_ServerAPI", "PlayerToEntity"),
/** 启用错误方块清理 @type {function():void} */ /** 启用错误方块清理 @type {function():void} */
setUnknownBlockCleaner: ll.import("GMLib_ModAPI", "setUnknownBlockCleaner"), setUnknownBlockCleaner: ll.imports("GMLib_ModAPI", "setUnknownBlockCleaner"),
/** 获取实验性功能ID列表 @type {function():Array<number>} */ /** 获取实验性功能ID列表 @type {function():Array<number>} */
getAllExperiments: ll.import("GMLIB_API", "getAllExperiments"), getAllExperiments: ll.imports("GMLIB_API", "getAllExperiments"),
/** 获取实验性功能文本的键名 @type {function(number):string} */ /** 获取实验性功能文本的键名 @type {function(number):string} */
getExperimentTranslateKey: ll.import("GMLIB_API", "getExperimentTranslateKey"), getExperimentTranslateKey: ll.imports("GMLIB_API", "getExperimentTranslateKey"),
/** 获取实验性功能启用状态 @type {function(number):boolean} */ /** 获取实验性功能启用状态 @type {function(number):boolean} */
getExperimentEnabled: ll.import("GMLib_ModAPI", "getExperimentEnabled"), getExperimentEnabled: ll.imports("GMLib_ModAPI", "getExperimentEnabled"),
/** 设置实验性功能启用状态 @type {function(number,boolean):void} */ /** 设置实验性功能启用状态 @type {function(number,boolean):void} */
setExperimentEnabled: ll.import("GMLib_ModAPI", "setExperimentEnabled"), setExperimentEnabled: ll.imports("GMLib_ModAPI", "setExperimentEnabled"),
/** 注销合成表 @type {function(string):boolean} */ /** 注销合成表 @type {function(string):boolean} */
unregisterRecipe: ll.import("GMLIB_API", "unregisterRecipe"), unregisterRecipe: ll.imports("GMLIB_API", "unregisterRecipe"),
/** 设置实验性依赖 @type {function(number):void} */ /** 设置实验性依赖 @type {function(number):void} */
registerExperimentsRequire: ll.import("GMLib_ModAPI", "registerExperimentsRequire"), registerExperimentsRequire: ll.imports("GMLib_ModAPI", "registerExperimentsRequire"),
/** 注册切石机合成表 @type {function(string,string,number,string,number,number):boolean} */ /** 注册切石机合成表 @type {function(string,string,number,string,number,number):boolean} */
registerStoneCutterRecipe: ll.import("GMLib_ModAPI", "registerStoneCutterRecipe"), registerStoneCutterRecipe: ll.imports("GMLib_ModAPI", "registerStoneCutterRecipe"),
/** 注册锻造纹饰合成表 @type {function(string,string,string,string):boolean} */ /** 注册锻造纹饰合成表 @type {function(string,string,string,string):boolean} */
registerSmithingTrimRecipe: ll.import("GMLib_ModAPI", "registerSmithingTrimRecipe"), registerSmithingTrimRecipe: ll.imports("GMLib_ModAPI", "registerSmithingTrimRecipe"),
/** 注册锻造配方合成表 @type {function(string,string,string,string):boolean} */ /** 注册锻造配方合成表 @type {function(string,string,string,string):boolean} */
registerSmithingTransformRecipe: ll.import("GMLib_ModAPI", "registerSmithingTransformRecipe"), registerSmithingTransformRecipe: ll.imports("GMLib_ModAPI", "registerSmithingTransformRecipe"),
/** 注册酿造容器表 @type {function(string,string,string,string):boolean} */ /** 注册酿造容器表 @type {function(string,string,string,string):boolean} */
registerBrewingContainerRecipe: ll.import("GMLib_ModAPI", "registerBrewingContainerRecipe"), registerBrewingContainerRecipe: ll.imports("GMLib_ModAPI", "registerBrewingContainerRecipe"),
/** 注册酿造混合表 @type {function(string,string,string,string):boolean} */ /** 注册酿造混合表 @type {function(string,string,string,string):boolean} */
registerBrewingMixRecipe: ll.import("GMLib_ModAPI", "registerBrewingMixRecipe"), registerBrewingMixRecipe: ll.imports("GMLib_ModAPI", "registerBrewingMixRecipe"),
/** 注册熔炼合成表 @type {function(string,string,string,Array.<string>):boolean} */ /** 注册熔炼合成表 @type {function(string,string,string,Array.<string>):boolean} */
registerFurnaceRecipe: ll.import("GMLib_ModAPI", "registerFurnaceRecipe"), registerFurnaceRecipe: ll.imports("GMLib_ModAPI", "registerFurnaceRecipe"),
/** 注册有序合成表 @type {function(string,Array.<string>,Array.<string>,string,number,string)} */ /** 注册有序合成表 @type {function(string,Array.<string>,Array.<string>,string,number,string)} */
registerShapedRecipe: ll.import("GMLib_ModAPI", "registerShapedRecipe"), registerShapedRecipe: ll.imports("GMLib_ModAPI", "registerShapedRecipe"),
/** 注册无序合成表 @type {function(string,Array.<string>,Array.<string>,string,number,string)} */ /** 注册无序合成表 @type {function(string,Array.<string>,Array.<string>,string,number,string)} */
registerShapelessRecipe: ll.import("GMLib_ModAPI", "registerShapelessRecipe"), registerShapelessRecipe: ll.imports("GMLib_ModAPI", "registerShapelessRecipe"),
/** 注册有序合成表 @type {function(string,Array.<string>,Array.<string>,string,number,string)} */ /** 注册有序合成表 @type {function(string,Array.<string>,Array.<string>,string,number,string)} */
registerCustomShapedRecipe: ll.import("GMLIB_API", "registerCustomShapedRecipe"), registerCustomShapedRecipe: ll.imports("GMLIB_API", "registerCustomShapedRecipe"),
/** 注册无序合成表 @type {function(string,Array.<string>,Array.<string>,string,number,string)} */ /** 注册无序合成表 @type {function(string,Array.<string>,Array.<string>,string,number,string)} */
registerCustomShapelessRecipe: ll.import("GMLIB_API", "registerCustomShapelessRecipe"), registerCustomShapelessRecipe: ll.imports("GMLIB_API", "registerCustomShapelessRecipe"),
/** 检测LRCA版本是否大于或等于此版本 @type {function(number,number,number):boolean} */ /** 检测LRCA版本是否大于或等于此版本 @type {function(number,number,number):boolean} */
isVersionMatched: ll.import("GMLIB_API", "isVersionMatched"), isVersionMatched: ll.imports("GMLIB_API", "isVersionMatched"),
/** 获取LRCA版本 @type {function():string} */ /** 获取LRCA版本 @type {function():string} */
getVersion_LRCA: ll.import("GMLIB_API", "getVersion_LRCA"), getVersion_LRCA: ll.imports("GMLIB_API", "getVersion_LRCA"),
/** 获取GMLIB版本 @type {function():string} */ /** 获取GMLIB版本 @type {function():string} */
getVersion_GMLIB: ll.import("GMLIB_API", "getVersion_GMLIB"), getVersion_GMLIB: ll.imports("GMLIB_API", "getVersion_GMLIB"),
/** 获取玩家坐标 @type {function(string):IntPos} */ /** 获取玩家坐标 @type {function(string):IntPos} */
getPlayerPosition: ll.import("GMLIB_API", "getPlayerPosition"), getPlayerPosition: ll.imports("GMLIB_API", "getPlayerPosition"),
/** 设置玩家坐标 @type {function(string,IntPos):boolean} */ /** 设置玩家坐标 @type {function(string,IntPos):boolean} */
setPlayerPosition: ll.import("GMLIB_API", "setPlayerPosition"), setPlayerPosition: ll.imports("GMLIB_API", "setPlayerPosition"),
/** 玩家是否存在于计分板 @type {function(string,string):boolean} */ /** 玩家是否存在于计分板 @type {function(string,string):boolean} */
playerHasScore: ll.import("GMLIB_API", "playerHasScore"), playerHasScore: ll.imports("GMLIB_API", "playerHasScore"),
/** 获取玩家在计分板中的值 @type {function(string,string):number} */ /** 获取玩家在计分板中的值 @type {function(string,string):number} */
getPlayerScore: ll.import("GMLIB_API", "getPlayerScore"), getPlayerScore: ll.imports("GMLIB_API", "getPlayerScore"),
/** 增加玩家在计分板中的值 @type {function(string,string,number):boolean} */ /** 增加玩家在计分板中的值 @type {function(string,string,number):boolean} */
addPlayerScore: ll.import("GMLIB_API", "addPlayerScore"), addPlayerScore: ll.imports("GMLIB_API", "addPlayerScore"),
/** 减少玩家在计分板中的值 @type {function(string,string,number):boolean} */ /** 减少玩家在计分板中的值 @type {function(string,string,number):boolean} */
reducePlayerScore: ll.import("GMLIB_API", "reducePlayerScore"), reducePlayerScore: ll.imports("GMLIB_API", "reducePlayerScore"),
/** 设置玩家在计分板中的值 @type {function(string,string,number):boolean} */ /** 设置玩家在计分板中的值 @type {function(string,string,number):boolean} */
setPlayerScore: ll.import("GMLIB_API", "setPlayerScore"), setPlayerScore: ll.imports("GMLIB_API", "setPlayerScore"),
/** 重置玩家在计分板中的数据 @type {function(string,string):boolean} */ /** 重置玩家在计分板中的数据 @type {function(string,string):boolean} */
resetPlayerScore: ll.import("GMLIB_API", "resetPlayerScore"), resetPlayerScore: ll.imports("GMLIB_API", "resetPlayerScore"),
/** 重置玩家所有的计分板数据 @type {function(string):boolean} */ /** 重置玩家所有的计分板数据 @type {function(string):boolean} */
resetPlayerScores: ll.import("GMLIB_API", "resetPlayerScores"), resetPlayerScores: ll.imports("GMLIB_API", "resetPlayerScores"),
/** 实体是否存在于计分板中 @type {function(string,string):boolean} */ /** 实体是否存在于计分板中 @type {function(string,string):boolean} */
entityHasScore: ll.import("GMLIB_API", "entityHasScore"), entityHasScore: ll.imports("GMLIB_API", "entityHasScore"),
/** 获取实体在计分板中的值 @type {function(string,string):number} */ /** 获取实体在计分板中的值 @type {function(string,string):number} */
getEntityScore: ll.import("GMLIB_API", "getEntityScore"), getEntityScore: ll.imports("GMLIB_API", "getEntityScore"),
/** 增加实体在计分板中的值 @type {function(string,string,number):boolean} */ /** 增加实体在计分板中的值 @type {function(string,string,number):boolean} */
addEntityScore: ll.import("GMLIB_API", "addEntityScore"), addEntityScore: ll.imports("GMLIB_API", "addEntityScore"),
/** 减少实体在计分板中的值 @type {function(string,string,number):boolean} */ /** 减少实体在计分板中的值 @type {function(string,string,number):boolean} */
reduceEntityScore: ll.import("GMLIB_API", "reduceEntityScore"), reduceEntityScore: ll.imports("GMLIB_API", "reduceEntityScore"),
/** 设置实体在计分板中的值 @type {function(string,string,number):boolean} */ /** 设置实体在计分板中的值 @type {function(string,string,number):boolean} */
setEntityScore: ll.import("GMLIB_API", "setEntityScore"), setEntityScore: ll.imports("GMLIB_API", "setEntityScore"),
/** 重置实体在计分板中的数据 @type {function(string,string):boolean} */ /** 重置实体在计分板中的数据 @type {function(string,string):boolean} */
resetEntityScore: ll.import("GMLIB_API", "resetEntityScore"), resetEntityScore: ll.imports("GMLIB_API", "resetEntityScore"),
/** 重置实体所有的计分板数据 @type {function(string):boolean} */ /** 重置实体所有的计分板数据 @type {function(string):boolean} */
resetEntityScores: ll.import("GMLIB_API", "resetEntityScores"), resetEntityScores: ll.imports("GMLIB_API", "resetEntityScores"),
/** 字符串是否存在于计分板 @type {function(string,string):boolean} */ /** 字符串是否存在于计分板 @type {function(string,string):boolean} */
fakePlayerHasScore: ll.import("GMLIB_API", "fakePlayerHasScore"), fakePlayerHasScore: ll.imports("GMLIB_API", "fakePlayerHasScore"),
/** 获取字符串在计分板中的值 @type {function(string,string):number} */ /** 获取字符串在计分板中的值 @type {function(string,string):number} */
getFakePlayerScore: ll.import("GMLIB_API", "getFakePlayerScore"), getFakePlayerScore: ll.imports("GMLIB_API", "getFakePlayerScore"),
/** 增加字符串在计分板中的值 @type {function(string,string,number):boolean} */ /** 增加字符串在计分板中的值 @type {function(string,string,number):boolean} */
addFakePlayerScore: ll.import("GMLIB_API", "addFakePlayerScore"), addFakePlayerScore: ll.imports("GMLIB_API", "addFakePlayerScore"),
/** 减少字符串在计分板中的值 @type {function(string,string,number):boolean} */ /** 减少字符串在计分板中的值 @type {function(string,string,number):boolean} */
reduceFakePlayerScore: ll.import("GMLIB_API", "reduceFakePlayerScore"), reduceFakePlayerScore: ll.imports("GMLIB_API", "reduceFakePlayerScore"),
/** 设置字符串在计分板中的值 @type {function(string,string,number):boolean} */ /** 设置字符串在计分板中的值 @type {function(string,string,number):boolean} */
setFakePlayerScore: ll.import("GMLIB_API", "setFakePlayerScore"), setFakePlayerScore: ll.imports("GMLIB_API", "setFakePlayerScore"),
/** 重置字符串在计分板中的数据 @type {function(string,string):boolean} */ /** 重置字符串在计分板中的数据 @type {function(string,string):boolean} */
resetFakePlayerScore: ll.import("GMLIB_API", "resetFakePlayerScore"), resetFakePlayerScore: ll.imports("GMLIB_API", "resetFakePlayerScore"),
/** 重置字符串所有的计分板数据 @type {function(string):boolean} */ /** 重置字符串所有的计分板数据 @type {function(string):boolean} */
resetFakePlayerScores: ll.import("GMLIB_API", "resetFakePlayerScores"), resetFakePlayerScores: ll.imports("GMLIB_API", "resetFakePlayerScores"),
/** 创建计分板 @type {function(string):boolean} */ /** 创建计分板 @type {function(string):boolean} */
addObjective: ll.import("GMLIB_API", "addObjective"), addObjective: ll.imports("GMLIB_API", "addObjective"),
/** 创建带有显示名称的计分板 @type {function(string,string):boolean} */ /** 创建带有显示名称的计分板 @type {function(string,string):boolean} */
addObjectiveWithDisplayName: ll.import("GMLIB_API", "addObjectiveWithDisplayName"), addObjectiveWithDisplayName: ll.imports("GMLIB_API", "addObjectiveWithDisplayName"),
/** 获取计分板显示名字 @type {function(string):string} */ /** 获取计分板显示名字 @type {function(string):string} */
getDisplayName: ll.import("GMLIB_API", "getDisplayName"), getDisplayName: ll.imports("GMLIB_API", "getDisplayName"),
/** 设置计分板显示名字 @type {function(string,string):boolean} */ /** 设置计分板显示名字 @type {function(string,string):boolean} */
setDisplayName: ll.import("GMLIB_API", "setDisplayName"), setDisplayName: ll.imports("GMLIB_API", "setDisplayName"),
/** 删除计分板 @type {function(string):boolean} */ /** 删除计分板 @type {function(string):boolean} */
removeObjective: ll.import("GMLIB_API", "removeObjective"), removeObjective: ll.imports("GMLIB_API", "removeObjective"),
/** 设置计分板显示 @type {function(string,"list"|"sidebar"|"belowname",0|1):void} */ /** 设置计分板显示 @type {function(string,"list"|"sidebar"|"belowname",0|1):void} */
setDisplayObjective: ll.import("GMLIB_API", "setDisplayObjective"), setDisplayObjective: ll.imports("GMLIB_API", "setDisplayObjective"),
/** 清除计分板显示 @type {function("list"|"sidebar"|"belowname"):void} */ /** 清除计分板显示 @type {function("list"|"sidebar"|"belowname"):void} */
clearDisplayObjective: ll.import("GMLIB_API", "clearDisplayObjective"), clearDisplayObjective: ll.imports("GMLIB_API", "clearDisplayObjective"),
/** 获取所有计分板 @type {function():Array.<string>} */ /** 获取所有计分板 @type {function():Array.<string>} */
getAllObjectives: ll.import("GMLIB_API", "getAllObjectives"), getAllObjectives: ll.imports("GMLIB_API", "getAllObjectives"),
/** 获取所有跟踪目标 @type {function():Array.<{"Type":"Player","Uuid":string}|{"Type":"FakePlayer","Name":string}|{"Type":"Entity","UniqueId":string}>} */ /** 获取所有跟踪目标 @type {function():Array.<{"Type":"Player","Uuid":string}|{"Type":"FakePlayer","Name":string}|{"Type":"Entity","UniqueId":string}>} */
getAllTrackedTargets: ll.import("GMLIB_API", "getAllTrackedTargets"), getAllTrackedTargets: ll.imports("GMLIB_API", "getAllTrackedTargets"),
/** 获取所有跟踪玩家 @type {function():Array.<string>} */ /** 获取所有跟踪玩家 @type {function():Array.<string>} */
getAllScoreboardPlayers: ll.import("GMLIB_API", "getAllScoreboardPlayers"), getAllScoreboardPlayers: ll.imports("GMLIB_API", "getAllScoreboardPlayers"),
/** 获取所有跟踪字符串 @type {function():Array.<string>} */ /** 获取所有跟踪字符串 @type {function():Array.<string>} */
getAllScoreboardFakePlayers: ll.import("GMLIB_API", "getAllScoreboardFakePlayers"), getAllScoreboardFakePlayers: ll.imports("GMLIB_API", "getAllScoreboardFakePlayers"),
/** 获取所有跟踪实体 @type {function():Array.<string>} */ /** 获取所有跟踪实体 @type {function():Array.<string>} */
getAllScoreboardEntities: ll.import("GMLIB_API", "getAllScoreboardEntities"), getAllScoreboardEntities: ll.imports("GMLIB_API", "getAllScoreboardEntities"),
/** 根据uuid获取玩家对象 @type {function(string):Player} */ /** 根据uuid获取玩家对象 @type {function(string):Player} */
getPlayerFromUuid: ll.import("GMLIB_API", "getPlayerFromUuid"), getPlayerFromUuid: ll.imports("GMLIB_API", "getPlayerFromUuid"),
/** 根据UniqueId获取玩家对象 @type {function(string):Player} */ /** 根据UniqueId获取玩家对象 @type {function(string):Player} */
getPlayerFromUniqueId: ll.import("GMLIB_API", "getPlayerFromUniqueId"), getPlayerFromUniqueId: ll.imports("GMLIB_API", "getPlayerFromUniqueId"),
/** 根据UniqueId获取实体对象 @type {function(string):Entity} */ /** 根据UniqueId获取实体对象 @type {function(string):Entity} */
getEntityFromUniqueId: ll.import("GMLIB_API", "getEntityFromUniqueId"), getEntityFromUniqueId: ll.imports("GMLIB_API", "getEntityFromUniqueId"),
/** 获取世界出生点 @type {function():IntPos} */ /** 获取世界出生点 @type {function():IntPos} */
getWorldSpawn: ll.import("GMLIB_API", "getWorldSpawn"), getWorldSpawn: ll.imports("GMLIB_API", "getWorldSpawn"),
/** 设置世界出生点 @type {function(IntPos):void} */ /** 设置世界出生点 @type {function(IntPos):void} */
setWorldSpawn: ll.import("GMLIB_API", "setWorldSpawn"), setWorldSpawn: ll.imports("GMLIB_API", "setWorldSpawn"),
/** 获取玩家重生点 @type {function(Player):IntPos} */ /** 获取玩家重生点 @type {function(Player):IntPos} */
getPlayerSpawnPoint: ll.import("GMLIB_API", "getPlayerSpawnPoint"), getPlayerSpawnPoint: ll.imports("GMLIB_API", "getPlayerSpawnPoint"),
/** 设置玩家重生点 @type {function(Player,IntPos):void} */ /** 设置玩家重生点 @type {function(Player,IntPos):void} */
setPlayerSpawnPoint: ll.import("GMLIB_API", "setPlayerSpawnPoint"), setPlayerSpawnPoint: ll.imports("GMLIB_API", "setPlayerSpawnPoint"),
/** 清除玩家重生点 @type {function(Player):void} */ /** 清除玩家重生点 @type {function(Player):void} */
clearPlayerSpawnPoint: ll.import("GMLIB_API", "clearPlayerSpawnPoint"), clearPlayerSpawnPoint: ll.imports("GMLIB_API", "clearPlayerSpawnPoint"),
/** 设置资源包路径 @type {function(string):void} */ /** 设置资源包路径 @type {function(string):void} */
setCustomPackPath: ll.import("GMLIB_API", "setCustomPackPath"), setCustomPackPath: ll.imports("GMLIB_API", "setCustomPackPath"),
/** 获取支持的语言标识符 @type {function():Array.<string>} */ /** 获取支持的语言标识符 @type {function():Array.<string>} */
getSupportedLanguages: ll.import("GMLIB_API", "getSupportedLanguages"), getSupportedLanguages: ll.imports("GMLIB_API", "getSupportedLanguages"),
/** 加载语言翻译 @type {function(string,string):void} */ /** 加载语言翻译 @type {function(string,string):void} */
loadLanguage: ll.import("GMLIB_API", "loadLanguage"), loadLanguage: ll.imports("GMLIB_API", "loadLanguage"),
/** 更新或创建语言文件 @type {function(string,string,string):void} */ /** 更新或创建语言文件 @type {function(string,string,string):void} */
updateOrCreateLanguageFile: ll.import("GMLIB_API", "updateOrCreateLanguageFile"), updateOrCreateLanguageFile: ll.imports("GMLIB_API", "updateOrCreateLanguageFile"),
/** 加载语言文件目录 @type {function(string):void} */ /** 加载语言文件目录 @type {function(string):void} */
loadLanguagePath: ll.import("GMLIB_API", "loadLanguagePath"), loadLanguagePath: ll.imports("GMLIB_API", "loadLanguagePath"),
/** 合并json @type {function(string,string):string} */ /** 合并json @type {function(string,string):string} */
mergePatchJson: ll.import("GMLIB_API", "mergePatchJson"), mergePatchJson: ll.imports("GMLIB_API", "mergePatchJson"),
/** 根据uuid获取xuid @type {function(string):string} */ /** 根据uuid获取xuid @type {function(string):string} */
getXuidByUuid: ll.import("GMLIB_API", "getXuidByUuid"), getXuidByUuid: ll.imports("GMLIB_API", "getXuidByUuid"),
/** 根据uuid获取名字 @type {function(string):string} */ /** 根据uuid获取名字 @type {function(string):string} */
getNameByUuid: ll.import("GMLIB_API", "getNameByUuid"), getNameByUuid: ll.imports("GMLIB_API", "getNameByUuid"),
/** 根据xuid获取uuid @type {function(string):string} */ /** 根据xuid获取uuid @type {function(string):string} */
getUuidByXuid: ll.import("GMLIB_API", "getUuidByXuid"), getUuidByXuid: ll.imports("GMLIB_API", "getUuidByXuid"),
/** 根据xuid获取名字 @type {function(string):string} */ /** 根据xuid获取名字 @type {function(string):string} */
getNameByXuid: ll.import("GMLIB_API", "getNameByXuid"), getNameByXuid: ll.imports("GMLIB_API", "getNameByXuid"),
/** 根据名字获取xuid @type {function(string):string} */ /** 根据名字获取xuid @type {function(string):string} */
getXuidByName: ll.import("GMLIB_API", "getXuidByName"), getXuidByName: ll.imports("GMLIB_API", "getXuidByName"),
/** 根据名字获取uuid @type {function(string):string} */ /** 根据名字获取uuid @type {function(string):string} */
getUuidByName: ll.import("GMLIB_API", "getUuidByName"), getUuidByName: ll.imports("GMLIB_API", "getUuidByName"),
/** 获取所有已记录的玩家信息 @type {function():Array.<{"Uuid":string,"Xuid":string,"Name":string}>} */ /** 获取所有已记录的玩家信息 @type {function():Array.<{"Uuid":string,"Xuid":string,"Name":string}>} */
getAllPlayerInfo: ll.import("GMLIB_API", "getAllPlayerInfo"), getAllPlayerInfo: ll.imports("GMLIB_API", "getAllPlayerInfo"),
/** 获取方块RuntimeId @type {function(string,number):number} */ /** 获取方块RuntimeId @type {function(string,number):number} */
getBlockRuntimeId: ll.import("GMLIB_API", "getBlockRuntimeId"), getBlockRuntimeId: ll.imports("GMLIB_API", "getBlockRuntimeId"),
/** 添加虚假列表玩家 @type {function(string,string):boolean} */ /** 添加虚假列表玩家 @type {function(string,string):boolean} */
addFakeList: ll.import("GMLIB_API", "addFakeList"), addFakeList: ll.imports("GMLIB_API", "addFakeList"),
/** 删除虚假列表玩家 @type {function(string):boolean} */ /** 删除虚假列表玩家 @type {function(string):boolean} */
removeFakeList: ll.import("GMLIB_API", "removeFakeList"), removeFakeList: ll.imports("GMLIB_API", "removeFakeList"),
/** 删除所有虚假列表玩家 @type {function():void} */ /** 删除所有虚假列表玩家 @type {function():void} */
removeAllFakeLists: ll.import("GMLIB_API", "removeAllFakeList"), removeAllFakeLists: ll.imports("GMLIB_API", "removeAllFakeList"),
/** 启用I18n修复 @type {function():void} */ /** 启用I18n修复 @type {function():void} */
setFixI18nEnabled: ll.import("GMLib_ModAPI", "setFixI18nEnabled"), setFixI18nEnabled: ll.imports("GMLib_ModAPI", "setFixI18nEnabled"),
/** 获取方块翻译键名 @type {function(Block):string} */ /** 获取方块翻译键名 @type {function(Block):string} */
getBlockTranslateKey: ll.import("GMLIB_API", "getBlockTranslateKey"), getBlockTranslateKey: ll.imports("GMLIB_API", "getBlockTranslateKey"),
/** 获取物品翻译键名 @type {function(Item):string} */ /** 获取物品翻译键名 @type {function(Item):string} */
getItemTranslateKey: ll.import("GMLIB_API", "getItemTranslateKey"), getItemTranslateKey: ll.imports("GMLIB_API", "getItemTranslateKey"),
/** 获取实体翻译键名 @type {function(Entity):string} */ /** 获取实体翻译键名 @type {function(Entity):string} */
getEntityTranslateKey: ll.import("GMLIB_API", "getEntityTranslateKey"), getEntityTranslateKey: ll.imports("GMLIB_API", "getEntityTranslateKey"),
/** 从文件中读取NBT @type {function(string,boolean):NbtCompound} */ /** 从文件中读取NBT @type {function(string,boolean):NbtCompound} */
readNbtFromFile: ll.import("GMLIB_API", "readNbtFromFile"), readNbtFromFile: ll.imports("GMLIB_API", "readNbtFromFile"),
/** 保存NBT至文件 @type {function(string,NbtCompound,boolean):void} */ /** 保存NBT至文件 @type {function(string,NbtCompound,boolean):void} */
saveNbtToFile: ll.import("GMLIB_API", "saveNbtToFile"), saveNbtToFile: ll.imports("GMLIB_API", "saveNbtToFile"),
/** 获取方块硬度 @type {function(Block):number} */ /** 获取方块硬度 @type {function(Block):number} */
getBlockDestroySpeed: ll.import("GMLIB_API", "getBlockDestroySpeed"), getBlockDestroySpeed: ll.imports("GMLIB_API", "getBlockDestroySpeed"),
/** 获取物品挖掘方块速度 @type {function(Item,Block):number} */ /** 获取物品挖掘方块速度 @type {function(Item,Block):number} */
getDestroyBlockSpeed: ll.import("GMLIB_API", "getDestroyBlockSpeed"), getDestroyBlockSpeed: ll.imports("GMLIB_API", "getDestroyBlockSpeed"),
/** 使玩家挖掘方块 @type {function(Block,IntPos,Player):void} */ /** 使玩家挖掘方块 @type {function(Block,IntPos,Player):void} */
playerDestroyBlock: ll.import("GMLIB_API", "playerDestroyBlock"), playerDestroyBlock: ll.imports("GMLIB_API", "playerDestroyBlock"),
/** 物品冒险模式下是否可以挖掘方块 @type {function(Item,Block):boolean} */ /** 物品冒险模式下是否可以挖掘方块 @type {function(Item,Block):boolean} */
itemCanDestroyBlock: ll.import("GMLIB_API", "itemCanDestroyBlock"), itemCanDestroyBlock: ll.imports("GMLIB_API", "itemCanDestroyBlock"),
/** 物品是否能破坏方块 @type {function(Item):boolean} */ /** 物品是否能破坏方块 @type {function(Item):boolean} */
itemCanDestroyInCreative: ll.import("GMLIB_API", "itemCanDestroyInCreative"), itemCanDestroyInCreative: ll.imports("GMLIB_API", "itemCanDestroyInCreative"),
/** 物品是否可以采集方块 @type {function(Item,Block):boolean} */ /** 物品是否可以采集方块 @type {function(Item,Block):boolean} */
itemCanDestroySpecial: ll.import("GMLIB_API", "itemCanDestroySpecial"), itemCanDestroySpecial: ll.imports("GMLIB_API", "itemCanDestroySpecial"),
/** @type {function(Block):boolean} */ /** @type {function(Block):boolean} */
blockCanDropWithAnyTool: ll.import("GMLIB_API", "blockCanDropWithAnyTool"), blockCanDropWithAnyTool: ll.imports("GMLIB_API", "blockCanDropWithAnyTool"),
/** @type {function(Block,Player,IntPos):boolean} */ /** @type {function(Block,Player,IntPos):boolean} */
blockPlayerWillDestroy: ll.import("GMLIB_API", "blockPlayerWillDestroy"), blockPlayerWillDestroy: ll.imports("GMLIB_API", "blockPlayerWillDestroy"),
/** 使玩家攻击实体 @type {function(Entity,Player):boolean} */ /** 使玩家攻击实体 @type {function(Entity,Player):boolean} */
playerAttack: ll.import("GMLIB_API", "playerAttack"), playerAttack: ll.imports("GMLIB_API", "playerAttack"),
/** @type {function(Player,Entity):void} */ /** @type {function(Player,Entity):void} */
playerPullInEntity: ll.import("GMLIB_API", "playerPullInEntity"), playerPullInEntity: ll.imports("GMLIB_API", "playerPullInEntity"),
/** 根据命令空间获取翻译键名 @type {function(string):string} */ /** 根据命令空间获取翻译键名 @type {function(string):string} */
getBlockTranslateKeyFromName: ll.import("GMLIB_API", "getBlockTranslateKeyFromName"), getBlockTranslateKeyFromName: ll.imports("GMLIB_API", "getBlockTranslateKeyFromName"),
/** 获取存档种子 @type {function():string} */ /** 获取存档种子 @type {function():string} */
getLevelSeed: ll.import("GMLib_ServerAPI", "getLevelSeed"), getLevelSeed: ll.imports("GMLib_ServerAPI", "getLevelSeed"),
/** 获取方块亮度 @type {function(string,number):number} */ /** 获取方块亮度 @type {function(string,number):number} */
getBlockLightEmission: ll.import("GMLIB_API", "getBlockLightEmission"), getBlockLightEmission: ll.imports("GMLIB_API", "getBlockLightEmission"),
/** 获取游戏规则列表 @type {function():Array.<{Name:string,Value:string,Type:"Bool"|"Float"|"Int"}>} */ /** 获取游戏规则列表 @type {function():Array.<{Name:string,Value:string,Type:"Bool"|"Float"|"Int"}>} */
getGameRules: ll.import("GMLIB_API", "getGameRules"), getGameRules: ll.imports("GMLIB_API", "getGameRules"),
/** 给物品添加附魔 @type {function(Item,string,number,boolean):boolean} */ /** 给物品添加附魔 @type {function(Item,string,number,boolean):boolean} */
applyEnchant: ll.import("GMLIB_API", "applyEnchant"), applyEnchant: ll.imports("GMLIB_API", "applyEnchant"),
/** 删除物品所有附魔 @type {function(Item):void} */ /** 删除物品所有附魔 @type {function(Item):void} */
removeEnchants: ll.import("GMLIB_API", "removeEnchants"), removeEnchants: ll.imports("GMLIB_API", "removeEnchants"),
/** 判断物品是否拥有附魔 @type {function(Item,string):boolean} */ /** 判断物品是否拥有附魔 @type {function(Item,string):boolean} */
hasEnchant: ll.import("GMLIB_API", "hasEnchant"), hasEnchant: ll.imports("GMLIB_API", "hasEnchant"),
/** 获取附魔等级 @type {function(Item,string):number} */ /** 获取附魔等级 @type {function(Item,string):number} */
getEnchantLevel: ll.import("GMLIB_API", "getEnchantLevel"), getEnchantLevel: ll.imports("GMLIB_API", "getEnchantLevel"),
/** 获取附魔名字 @type {function(string,number):number} */ /** 获取附魔名字 @type {function(string,number):number} */
getEnchantNameAndLevel: ll.import("GMLIB_API", "getEnchantNameAndLevel"), getEnchantNameAndLevel: ll.imports("GMLIB_API", "getEnchantNameAndLevel"),
/** 通过ID获取附魔命名空间ID @type {function(number):string} */ /** 通过ID获取附魔命名空间ID @type {function(number):string} */
getEnchantTypeNameFromId: ll.import("GMLIB_API", "getEnchantTypeNameFromId"), getEnchantTypeNameFromId: ll.imports("GMLIB_API", "getEnchantTypeNameFromId"),
/** 获取最大玩家数 @type {function():number} */ /** 获取最大玩家数 @type {function():number} */
getMaxPlayers: ll.import("GMLib_ServerAPI", "getMaxPlayers"), getMaxPlayers: ll.imports("GMLib_ServerAPI", "getMaxPlayers"),
/** 丢出玩家背包内物品 @type {function(Player,Item,boolean):boolean} */ /** 丢出玩家背包内物品 @type {function(Player,Item,boolean):boolean} */
dropPlayerItem: ll.import("GMLIB_API", "dropPlayerItem"), dropPlayerItem: ll.imports("GMLIB_API", "dropPlayerItem"),
/** 获取玩家的RuntimeId @type {function(Player):number} */ /** 获取玩家的RuntimeId @type {function(Player):number} */
getPlayerRuntimeId: ll.import("GMLIB_API", "getPlayerRuntimeId"), getPlayerRuntimeId: ll.imports("GMLIB_API", "getPlayerRuntimeId"),
/** 获取实体的RuntimeId @type {function(Entity):number} */ /** 获取实体的RuntimeId @type {function(Entity):number} */
getEntityRuntimeId: ll.import("GMLIB_API", "getEntityRuntimeId"), getEntityRuntimeId: ll.imports("GMLIB_API", "getEntityRuntimeId"),
/** 获取实体命名 @type {function(Entity):string} */ /** 获取实体命名 @type {function(Entity):string} */
getEntityNameTag: ll.import("GMLIB_API", "getEntityNameTag"), getEntityNameTag: ll.imports("GMLIB_API", "getEntityNameTag"),
/** 物品是否有不可破坏标签 @type {function(Item):boolean} */ /** 物品是否有不可破坏标签 @type {function(Item):boolean} */
ItemisUnbreakable: ll.import("GMLIB_API", "ItemisUnbreakable"), ItemisUnbreakable: ll.imports("GMLIB_API", "ItemisUnbreakable"),
/** 设置物品不可破坏标签 @type {function(Item,boolean):void} */ /** 设置物品不可破坏标签 @type {function(Item,boolean):void} */
setItemUnbreakable: ll.import("GMLIB_API", "setItemUnbreakable"), setItemUnbreakable: ll.imports("GMLIB_API", "setItemUnbreakable"),
/** 物品是否死亡不会掉落 @type {function(Item):boolean} */ /** 物品是否死亡不会掉落 @type {function(Item):boolean} */
getItemShouldKeepOnDeath: ll.import("GMLIB_API", "getItemShouldKeepOnDeath"), getItemShouldKeepOnDeath: ll.imports("GMLIB_API", "getItemShouldKeepOnDeath"),
/** 设置物品死亡不掉落 @type {function(Item,boolean):void} */ /** 设置物品死亡不掉落 @type {function(Item,boolean):void} */
setItemShouldKeepOnDeath: ll.import("GMLIB_API", "setItemShouldKeepOnDeath"), setItemShouldKeepOnDeath: ll.imports("GMLIB_API", "setItemShouldKeepOnDeath"),
/** 获取物品锁定模式 @type {function(Item):number} */ /** 获取物品锁定模式 @type {function(Item):number} */
getItemLockMode: ll.import("GMLIB_API", "getItemLockMode"), getItemLockMode: ll.imports("GMLIB_API", "getItemLockMode"),
/** 设置物品锁定模式 @type {function(Item,number):void} */ /** 设置物品锁定模式 @type {function(Item,number):void} */
setItemLockMode: ll.import("GMLIB_API", "setItemLockMode"), setItemLockMode: ll.imports("GMLIB_API", "setItemLockMode"),
/** 获取物品惩罚等级 @type {function(Item):number} */ /** 获取物品惩罚等级 @type {function(Item):number} */
getItemRepairCost: ll.import("GMLIB_API", "getItemRepairCost"), getItemRepairCost: ll.imports("GMLIB_API", "getItemRepairCost"),
/** 设置物品惩罚等级 @type {function(Item,number):void} */ /** 设置物品惩罚等级 @type {function(Item,number):void} */
setItemRepairCost: ll.import("GMLIB_API", "setItemRepairCost"), setItemRepairCost: ll.imports("GMLIB_API", "setItemRepairCost"),
/** 获取物品冒险模式下可破坏的方块 @type {function(Item):Array.<string>} */ /** 获取物品冒险模式下可破坏的方块 @type {function(Item):Array.<string>} */
getItemCanDestroy: ll.import("GMLIB_API", "getItemCanDestroy"), getItemCanDestroy: ll.imports("GMLIB_API", "getItemCanDestroy"),
/** 设置物品冒险模式下可破坏的方块 @type {function(Item,Array.<string>):void} */ /** 设置物品冒险模式下可破坏的方块 @type {function(Item,Array.<string>):void} */
setItemCanDestroy: ll.import("GMLIB_API", "setItemCanDestroy"), setItemCanDestroy: ll.imports("GMLIB_API", "setItemCanDestroy"),
/** 获取物品冒险模式下能放置在什么方块上 @type {function(Item):Array.<string>} */ /** 获取物品冒险模式下能放置在什么方块上 @type {function(Item):Array.<string>} */
getItemCanPlaceOn: ll.import("GMLIB_API", "getItemCanPlaceOn"), getItemCanPlaceOn: ll.imports("GMLIB_API", "getItemCanPlaceOn"),
/** 设置物品冒险模式下能放置在什么方块上 @type {function(Item,Array.<string>):void} */ /** 设置物品冒险模式下能放置在什么方块上 @type {function(Item,Array.<string>):void} */
setItemCanPlaceOn: ll.import("GMLIB_API", "setItemCanPlaceOn"), setItemCanPlaceOn: ll.imports("GMLIB_API", "setItemCanPlaceOn"),
/** 获取玩家饥饿值 @type {function(Player):number} */ /** 获取玩家饥饿值 @type {function(Player):number} */
getPlayerHungry: ll.import("GMLIB_API", "getPlayerHungry"), getPlayerHungry: ll.imports("GMLIB_API", "getPlayerHungry"),
/** 获取玩家盔甲覆盖百分比 @type {function(Player):number} */ /** 获取玩家盔甲覆盖百分比 @type {function(Player):number} */
getPlayerArmorCoverPercentage: ll.import("GMLIB_API", "getPlayerArmorCoverPercentage"), getPlayerArmorCoverPercentage: ll.imports("GMLIB_API", "getPlayerArmorCoverPercentage"),
/** 获取玩家盔甲值 @type {function(Player):number} */ /** 获取玩家盔甲值 @type {function(Player):number} */
getPlayerArmorValue: ll.import("GMLIB_API", "getPlayerArmorValue"), getPlayerArmorValue: ll.imports("GMLIB_API", "getPlayerArmorValue"),
/** 获取实体主人的UniqueID @type {function(Entity):Entity} */ /** 获取实体主人的UniqueID @type {function(Entity):Entity} */
getEntityOwnerUniqueId: ll.import("GMLIB_API", "getEntityOwnerUniqueId"), getEntityOwnerUniqueId: ll.imports("GMLIB_API", "getEntityOwnerUniqueId"),
/** 获取物品分类名称 @type {function(Item):string} */ /** 获取物品分类名称 @type {function(Item):string} */
getItemCategoryName: ll.import("GMLIB_API", "getItemCategoryName"), getItemCategoryName: ll.imports("GMLIB_API", "getItemCategoryName"),
/** 获取物品的命名 @type {function(Item):string} */ /** 获取物品的命名 @type {function(Item):string} */
getItemCustomName: ll.import("GMLIB_API", "getItemCustomName"), getItemCustomName: ll.imports("GMLIB_API", "getItemCustomName"),
/** 获取物品BUFF效果名称 @type {function(Item):string} */ /** 获取物品BUFF效果名称 @type {function(Item):string} */
getItemEffecName: ll.import("GMLIB_API", "getItemEffecName"), getItemEffecName: ll.imports("GMLIB_API", "getItemEffecName"),
/** 物品是否为食物 @type {function(Item):boolean} */ /** 物品是否为食物 @type {function(Item):boolean} */
itemIsFood: ll.import("GMLIB_API", "itemIsFood"), itemIsFood: ll.imports("GMLIB_API", "itemIsFood"),
/** 设置玩家UI栏物品 @type {function(Player,number,Item):void} */ /** 设置玩家UI栏物品 @type {function(Player,number,Item):void} */
setPlayerUIItem: ll.import("GMLIB_API", "setPlayerUIItem"), setPlayerUIItem: ll.imports("GMLIB_API", "setPlayerUIItem"),
/** 获取玩家UI栏物品 @type {function(Player,number):Item} */ /** 获取玩家UI栏物品 @type {function(Player,number):Item} */
getPlayerUIItem: ll.import("GMLIB_API", "getPlayerUIItem"), getPlayerUIItem: ll.imports("GMLIB_API", "getPlayerUIItem"),
/** 更新玩家容器物品 @type {function(Player,number,number,Item):void} */ /** 更新玩家容器物品 @type {function(Player,number,number,Item):void} */
sendInventorySlotPacket: ll.import("GMLIB_API", "sendInventorySlotPacket"), sendInventorySlotPacket: ll.imports("GMLIB_API", "sendInventorySlotPacket"),
/** 获取容器类型 @type {function(Container):string} */ /** 获取容器类型 @type {function(Container):string} */
getContainerType: ll.import("GMLIB_API", "getContainerType"), getContainerType: ll.imports("GMLIB_API", "getContainerType"),
/** 玩家是否拥有NBT @type {function(string):boolean} */ /** 玩家是否拥有NBT @type {function(string):boolean} */
hasPlayerNbt: ll.import("GMLIB_API", "hasPlayerNbt"), hasPlayerNbt: ll.imports("GMLIB_API", "hasPlayerNbt"),
/** 获取物品最大堆叠数量 @type {function(Item):number} */ /** 获取物品最大堆叠数量 @type {function(Item):number} */
getItemMaxCount: ll.import("GMLIB_API", "getItemMaxCount"), getItemMaxCount: ll.imports("GMLIB_API", "getItemMaxCount"),
/** 实体包含在某族里 @type {function(Entity,string):boolean} */ /** 实体包含在某族里 @type {function(Entity,string):boolean} */
entityHasFamily: ll.import("GMLIB_API", "entityHasFamily"), entityHasFamily: ll.imports("GMLIB_API", "entityHasFamily"),
/** 获取玩家破坏方块所需时间 @type {function(Player,Block):number} */ /** 获取玩家破坏方块所需时间 @type {function(Player,Block):number} */
getPlayerDestroyBlockProgress: ll.import("GMLIB_API", "getPlayerDestroyBlockProgress"), getPlayerDestroyBlockProgress: ll.imports("GMLIB_API", "getPlayerDestroyBlockProgress"),
/** 获取实体的buff是否显示 @type {function(Player,number):boolean} */ /** 获取实体的buff是否显示 @type {function(Player,number):boolean} */
getEntityEffectVisible: ll.import("GMLIB_API", "getEntityEffectVisible"), getEntityEffectVisible: ll.imports("GMLIB_API", "getEntityEffectVisible"),
/** 获取实体的buff持续时间 @type {function(Player,number):number} */ /** 获取实体的buff持续时间 @type {function(Player,number):number} */
getEntityEffectDuration: ll.import("GMLIB_API", "getEntityEffectDuration"), getEntityEffectDuration: ll.imports("GMLIB_API", "getEntityEffectDuration"),
/** 获取实体的buff简单模式下的持续时间 @type {function(Player,number):number} */ /** 获取实体的buff简单模式下的持续时间 @type {function(Player,number):number} */
getEntityEffectDurationEasy: ll.import("GMLIB_API", "getEntityEffectDuration"), getEntityEffectDurationEasy: ll.imports("GMLIB_API", "getEntityEffectDuration"),
/** 获取实体的buff困难模式下的持续时间 @type {function(Player,number):number} */ /** 获取实体的buff困难模式下的持续时间 @type {function(Player,number):number} */
getEntityEffectDurationHard: ll.import("GMLIB_API", "getEntityEffectDurationHard"), getEntityEffectDurationHard: ll.imports("GMLIB_API", "getEntityEffectDurationHard"),
/** 获取实体的buff普通模式下的持续时间 @type {function(Player,number):number} */ /** 获取实体的buff普通模式下的持续时间 @type {function(Player,number):number} */
getEntityEffectDurationNormal: ll.import("GMLIB_API", "getEntityEffectDurationNormal"), getEntityEffectDurationNormal: ll.imports("GMLIB_API", "getEntityEffectDurationNormal"),
/** 获取实体的buff效果等级 @type {function(Entity,number):number} */ /** 获取实体的buff效果等级 @type {function(Entity,number):number} */
getEntityEffectAmplifier: ll.import("GMLIB_API", "getEntityEffectAmplifier"), getEntityEffectAmplifier: ll.imports("GMLIB_API", "getEntityEffectAmplifier"),
/** 获取实体的buff是否为信标给予 @type {function(Entity,number):boolean} */ /** 获取实体的buff是否为信标给予 @type {function(Entity,number):boolean} */
getEntityEffectAmbient: ll.import("GMLIB_API", "getEntityEffectAmbient"), getEntityEffectAmbient: ll.imports("GMLIB_API", "getEntityEffectAmbient"),
/** 实体是否拥有buff效果 @type {function(Entity,number):boolean} */ /** 实体是否拥有buff效果 @type {function(Entity,number):boolean} */
entityHasEffect: ll.import("GMLIB_API", "entityHasEffect"), entityHasEffect: ll.imports("GMLIB_API", "entityHasEffect"),
/** 获取实体所有buff效果 @type {function(Entity):Array.<number>} */ /** 获取实体所有buff效果 @type {function(Entity):Array.<number>} */
getEntityAllEffects: ll.import("GMLIB_API", "getEntityAllEffects"), getEntityAllEffects: ll.imports("GMLIB_API", "getEntityAllEffects"),
/** 获取游戏难度 @type {function():number} */ /** 获取游戏难度 @type {function():number} */
getGameDifficulty: ll.import("GMLIB_API", "getGameDifficulty"), getGameDifficulty: ll.imports("GMLIB_API", "getGameDifficulty"),
/** 设置游戏难度 @type {function(difficulty):void} */ /** 设置游戏难度 @type {function(difficulty):void} */
setGameDifficulty: ll.import("GMLIB_API", "setGameDifficulty"), setGameDifficulty: ll.imports("GMLIB_API", "setGameDifficulty"),
/** 获取默认游戏模式 @type {function():number} */ /** 获取默认游戏模式 @type {function():number} */
getDefaultGameMode: ll.import("GMLIB_API", "getDefaultGameMode"), getDefaultGameMode: ll.imports("GMLIB_API", "getDefaultGameMode"),
/** 设置默认游戏模式 @type {function(mode):void} */ /** 设置默认游戏模式 @type {function(mode):void} */
setDefaultGameMode: ll.import("GMLIB_API", "setDefaultGameMode"), setDefaultGameMode: ll.imports("GMLIB_API", "setDefaultGameMode"),
/** 实体是否为某类型 @type {function(Entity, number):boolean} */ /** 实体是否为某类型 @type {function(Entity, number):boolean} */
entityIsType: ll.import("GMLIB_API", "entityIsType"), entityIsType: ll.imports("GMLIB_API", "entityIsType"),
/** 实体是包含某类型 @type {function(Entity, number):boolean} */ /** 实体是包含某类型 @type {function(Entity, number):boolean} */
entityHasType: ll.import("GMLIB_API", "entityHasType"), entityHasType: ll.imports("GMLIB_API", "entityHasType"),
/** 获取实体类型ID @type {function(Entity):number} */ /** 获取实体类型ID @type {function(Entity):number} */
getEntityTypeId: ll.import("GMLIB_API", "getEntityTypeId"), getEntityTypeId: ll.imports("GMLIB_API", "getEntityTypeId"),
/** 获取实体类型ID @type {function(Entity):number} */
getPlayerProtocolVersion: ll.imports("GMLIB_API", "getPlayerProtocolVersion"),
}; };
/** LRCA的二进制流数据包导出接口 */ /** LRCA的二进制流数据包导出接口 */
const GMLIB_BinaryStream_API = { const GMLIB_BinaryStream_API = {
/** 创建二进制流数据包 @type {function():number} */ /** 创建二进制流数据包 @type {function():number} */
create: ll.import("GMLIB_BinaryStream_API", "create"), create: ll.imports("GMLIB_BinaryStream_API", "create"),
/** 拷贝二进制流数据包 @type {function(number):number} */ /** 拷贝二进制流数据包 @type {function(number):number} */
copy: ll.import("GMLIB_BinaryStream_API", "copy"), copy: ll.imports("GMLIB_BinaryStream_API", "copy"),
/** 发送二进制流数据包 @type {function(number,player):void} */ /** 发送二进制流数据包 @type {function(number,player):void} */
sendTo: ll.import("GMLIB_BinaryStream_API", "sendTo"), sendTo: ll.imports("GMLIB_BinaryStream_API", "sendTo"),
/** 销毁二进制流数据包 @type {function(number):void} */ /** 销毁二进制流数据包 @type {function(number):void} */
destroy: ll.import("GMLIB_BinaryStream_API", "destroy"), destroy: ll.imports("GMLIB_BinaryStream_API", "destroy"),
/** 重置二进制流数据包 @type {function(number):void} */ /** 重置二进制流数据包 @type {function(number):void} */
reset: ll.import("GMLIB_BinaryStream_API", "reset"), reset: ll.imports("GMLIB_BinaryStream_API", "reset"),
/** 写入二进制流数据包头部 @type {function(number, number):void} */ /** 写入二进制流数据包头部 @type {function(number, number):void} */
writePacketHeader: ll.import("GMLIB_BinaryStream_API", "writePacketHeader"), writePacketHeader: ll.imports("GMLIB_BinaryStream_API", "writePacketHeader"),
/** 写入UUID @type {function(number, string):void} */ /** 写入UUID @type {function(number, string):void} */
writeUuid: ll.import("GMLIB_BinaryStream_API", "writeUuid"), writeUuid: ll.imports("GMLIB_BinaryStream_API", "writeUuid"),
/** 写入物品 @type {function(number, Item):void} */ /** 写入物品 @type {function(number, Item):void} */
writeItem: ll.import("GMLIB_BinaryStream_API", "writeItem"), writeItem: ll.imports("GMLIB_BinaryStream_API", "writeItem"),
/** 写入NBT @type {function(NbtCompound, Item):void} */ /** 写入NBT @type {function(NbtCompound, Item):void} */
writeCompoundTag: ll.import("GMLIB_BinaryStream_API", "writeCompoundTag"), writeCompoundTag: ll.imports("GMLIB_BinaryStream_API", "writeCompoundTag"),
/** 写入字符串 @type {function(number, string):void} */ /** 写入字符串 @type {function(number, string):void} */
writeString: ll.import("GMLIB_BinaryStream_API", "writeString"), writeString: ll.imports("GMLIB_BinaryStream_API", "writeString"),
/** 写入布尔值 @type {function(number, boolean):void} */ /** 写入布尔值 @type {function(number, boolean):void} */
writeBool: ll.import("GMLIB_BinaryStream_API", "writeBool"), writeBool: ll.imports("GMLIB_BinaryStream_API", "writeBool"),
/** 写入字节 @type {function(number, number):void} */ /** 写入字节 @type {function(number, number):void} */
writeByte: ll.import("GMLIB_BinaryStream_API", "writeByte"), writeByte: ll.imports("GMLIB_BinaryStream_API", "writeByte"),
/** 写入双精度浮点数 @type {function(number, number):void} */ /** 写入双精度浮点数 @type {function(number, number):void} */
writeDouble: ll.import("GMLIB_BinaryStream_API", "writeDouble"), writeDouble: ll.imports("GMLIB_BinaryStream_API", "writeDouble"),
/** 写入浮点数 @type {function(number, number):void} */ /** 写入浮点数 @type {function(number, number):void} */
writeFloat: ll.import("GMLIB_BinaryStream_API", "writeFloat"), writeFloat: ll.imports("GMLIB_BinaryStream_API", "writeFloat"),
/** @type {function(number, number):void} */ /** @type {function(number, number):void} */
writeSignedBigEndianInt: ll.import("GMLIB_BinaryStream_API", "writeSignedBigEndianInt"), writeSignedBigEndianInt: ll.imports("GMLIB_BinaryStream_API", "writeSignedBigEndianInt"),
/** @type {function(number, number):void} */ /** @type {function(number, number):void} */
writeSignedInt: ll.import("GMLIB_BinaryStream_API", "writeSignedInt"), writeSignedInt: ll.imports("GMLIB_BinaryStream_API", "writeSignedInt"),
/** @type {function(number, number):void} */ /** @type {function(number, number):void} */
writeSignedInt64: ll.import("GMLIB_BinaryStream_API", "writeSignedInt64"), writeSignedInt64: ll.imports("GMLIB_BinaryStream_API", "writeSignedInt64"),
/** @type {function(number, number):void} */ /** @type {function(number, number):void} */
writeSignedShort: ll.import("GMLIB_BinaryStream_API", "writeSignedShort"), writeSignedShort: ll.imports("GMLIB_BinaryStream_API", "writeSignedShort"),
/** @type {function(number, number):void} */ /** @type {function(number, number):void} */
writeUnsignedChar: ll.import("GMLIB_BinaryStream_API", "writeUnsignedChar"), writeUnsignedChar: ll.imports("GMLIB_BinaryStream_API", "writeUnsignedChar"),
/** @type {function(number, number):void} */ /** @type {function(number, number):void} */
writeUnsignedInt: ll.import("GMLIB_BinaryStream_API", "writeUnsignedInt"), writeUnsignedInt: ll.imports("GMLIB_BinaryStream_API", "writeUnsignedInt"),
/** @type {function(number, number):void} */ /** @type {function(number, number):void} */
writeUnsignedInt64: ll.import("GMLIB_BinaryStream_API", "writeUnsignedInt64"), writeUnsignedInt64: ll.imports("GMLIB_BinaryStream_API", "writeUnsignedInt64"),
/** @type {function(number, number):void} */ /** @type {function(number, number):void} */
writeUnsignedShort: ll.import("GMLIB_BinaryStream_API", "writeUnsignedShort"), writeUnsignedShort: ll.imports("GMLIB_BinaryStream_API", "writeUnsignedShort"),
/** @type {function(number, number):void} */ /** @type {function(number, number):void} */
writeUnsignedVarInt: ll.import("GMLIB_BinaryStream_API", "writeUnsignedVarInt"), writeUnsignedVarInt: ll.imports("GMLIB_BinaryStream_API", "writeUnsignedVarInt"),
/** @type {function(number, number):void} */ /** @type {function(number, number):void} */
writeUnsignedVarInt64: ll.import("GMLIB_BinaryStream_API", "writeUnsignedVarInt64"), writeUnsignedVarInt64: ll.imports("GMLIB_BinaryStream_API", "writeUnsignedVarInt64"),
/** @type {function(number, number):void} */ /** @type {function(number, number):void} */
writeVarInt: ll.import("GMLIB_BinaryStream_API", "writeVarInt"), writeVarInt: ll.imports("GMLIB_BinaryStream_API", "writeVarInt"),
/** @type {function(number, number):void} */ /** @type {function(number, number):void} */
writeVarInt64: ll.import("GMLIB_BinaryStream_API", "writeVarInt64"), writeVarInt64: ll.imports("GMLIB_BinaryStream_API", "writeVarInt64"),
}; };
/** 静态悬浮字类列表 @type {Map<number,StaticFloatingText>} */ /** 静态悬浮字类列表 @type {Map<number,StaticFloatingText>} */
@@ -3034,6 +3036,15 @@ LLSE_Player.prototype.sendInventorySlotPacket =
GMLIB_API.sendInventorySlotPacket(this, containerId, slot, item); GMLIB_API.sendInventorySlotPacket(this, containerId, slot, item);
}; };
LLSE_Player.prototype.getNetworkProtocolVersion =
/**
* 获取客户端版本协议
* @returns {number}
*/
function (containerId, slot, item) {
GMLIB_API.getPlayerProtocolVersion(this);
};
LLSE_Container.prototype.getContainerType = LLSE_Container.prototype.getContainerType =
/** /**
* 获取容器类型 * 获取容器类型
+8 -8
View File
@@ -75,8 +75,8 @@ function getStringHashCode(str) {
module.exports = { module.exports = {
translate(value, actor = undefined, language = "") { translate(value, actor = undefined, language = "") {
return actor instanceof LLSE_Entity return actor instanceof LLSE_Entity
? ll.imports("PlaceholderAPI", "translateFromActor")(value, actor, language) ? ll.importss("PlaceholderAPI", "translateFromActor")(value, actor, language)
: ll.imports("PlaceholderAPI", "translate")(value, language); : ll.importss("PlaceholderAPI", "translate")(value, language);
}, },
registerPlaceholder(placeholder, callback) { registerPlaceholder(placeholder, callback) {
const pluginName = getPluginName(); const pluginName = getPluginName();
@@ -84,19 +84,19 @@ module.exports = {
if(!args[0].uniqueId) args[0] = undefined; if(!args[0].uniqueId) args[0] = undefined;
return callback(...args) ?? "<std::nullopt>"; return callback(...args) ?? "<std::nullopt>";
}, pluginName, callback.getName()); }, pluginName, callback.getName());
ll.imports("PlaceholderAPI", "registerPlaceholder")(placeholder, callback.getName(), pluginName); ll.importss("PlaceholderAPI", "registerPlaceholder")(placeholder, callback.getName(), pluginName);
}, },
unregisterPlaceholder(placeholder) { unregisterPlaceholder(placeholder) {
return ll.imports("PlaceholderAPI", "unregisterPlaceholder")(placeholder); return ll.importss("PlaceholderAPI", "unregisterPlaceholder")(placeholder);
}, },
unregisterPlaceholderFromModName(placeholder) { unregisterPlaceholderFromModName(placeholder) {
return ll.imports("PlaceholderAPI", "unregisterPlaceholderFromModName")(placeholder); return ll.importss("PlaceholderAPI", "unregisterPlaceholderFromModName")(placeholder);
}, },
getValue(placeholder, actor = undefined, params = {}, language = "") { getValue(placeholder, actor = undefined, params = {}, language = "") {
if (actor instanceof LLSE_Player) actor = ll.import("GMLib_ServerAPI", "PlayerToEntity")(actor); if (actor instanceof LLSE_Player) actor = ll.imports("GMLib_ServerAPI", "PlayerToEntity")(actor);
const result = actor instanceof LLSE_Entity const result = actor instanceof LLSE_Entity
? ll.imports("PlaceholderAPI", "getValueFromActor")(placeholder, actor, params, language) ? ll.importss("PlaceholderAPI", "getValueFromActor")(placeholder, actor, params, language)
: ll.imports("PlaceholderAPI", "getValue")(placeholder, params, language); : ll.importss("PlaceholderAPI", "getValue")(placeholder, params, language);
return result !== "<std::nullopt>" ? result : undefined; return result !== "<std::nullopt>" ? result : undefined;
} }
}; };
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "${pluginName}", "name": "${pluginName}",
"entry": "${pluginFile}", "entry": "${pluginFile}",
"version": "1.0.0", "version": "1.1.1",
"author": "GroupMountain", "author": "GroupMountain",
"type": "native", "type": "native",
"passive": true, "passive": true,
+22 -21
View File
@@ -1,4 +1,5 @@
#include "Global.h" #include "Global.h"
#include "mc/platform/UUID.h"
#include <regex> #include <regex>
ActorUniqueID parseScriptUniqueID(std::string const& uniqueId) { ActorUniqueID parseScriptUniqueID(std::string const& uniqueId) {
@@ -35,7 +36,7 @@ void Export_Compatibility_API() {
return result; return result;
}); });
RemoteCall::exportAs("GMLIB_API", "getPlayerNbt", [](std::string const& uuid) -> std::unique_ptr<CompoundTag> { RemoteCall::exportAs("GMLIB_API", "getPlayerNbt", [](std::string const& uuid) -> std::unique_ptr<CompoundTag> {
if (auto player = OfflinePlayer::getOfflinePlayer(mce::UUID::fromString(uuid))) { if (auto player = OfflinePlayer::fromUuid(mce::UUID::fromString(uuid))) {
return std::make_unique<CompoundTag>(*player->getNbt()); return std::make_unique<CompoundTag>(*player->getNbt());
} }
return nullptr; return nullptr;
@@ -44,7 +45,7 @@ void Export_Compatibility_API() {
"GMLIB_API", "GMLIB_API",
"setPlayerNbt", "setPlayerNbt",
[](std::string const& uuid, CompoundTag* nbt, bool forceCreate) -> bool { [](std::string const& uuid, CompoundTag* nbt, bool forceCreate) -> bool {
if (auto player = OfflinePlayer::getOfflinePlayer(mce::UUID::fromString(uuid))) return player->setNbt(*nbt); if (auto player = OfflinePlayer::fromUuid(mce::UUID::fromString(uuid))) return player->setNbt(*nbt);
return forceCreate ? OfflinePlayer::createNewPlayerNbt(mce::UUID::fromString(uuid), *nbt).has_value() return forceCreate ? OfflinePlayer::createNewPlayerNbt(mce::UUID::fromString(uuid), *nbt).has_value()
: false; : false;
} }
@@ -53,7 +54,7 @@ void Export_Compatibility_API() {
"GMLIB_API", "GMLIB_API",
"setPlayerNbtTags", "setPlayerNbtTags",
[](std::string const& uuid, CompoundTag* nbt, std::vector<std::string> tags) -> bool { [](std::string const& uuid, CompoundTag* nbt, std::vector<std::string> tags) -> bool {
if (auto player = OfflinePlayer::getOfflinePlayer(mce::UUID::fromString(uuid))) { if (auto player = OfflinePlayer::fromUuid(mce::UUID::fromString(uuid))) {
auto nbt2 = *player->getNbt(); auto nbt2 = *player->getNbt();
GMCompoundTag::writeNbtTags(nbt2, *nbt, tags); GMCompoundTag::writeNbtTags(nbt2, *nbt, tags);
return player->setNbt(nbt2); return player->setNbt(nbt2);
@@ -152,7 +153,8 @@ void Export_Compatibility_API() {
); );
RemoteCall::exportAs("GMLIB_API", "getVersion_LRCA", []() -> std::string { return LIB_VERSION.to_string(); }); RemoteCall::exportAs("GMLIB_API", "getVersion_LRCA", []() -> std::string { return LIB_VERSION.to_string(); });
RemoteCall::exportAs("GMLIB_API", "getVersion_GMLIB", []() -> std::string { RemoteCall::exportAs("GMLIB_API", "getVersion_GMLIB", []() -> std::string {
return GMLIB_VERSION_TO_STRING(GMLIB_VERSION_MAJOR) "." GMLIB_VERSION_TO_STRING(GMLIB_VERSION_MINOR return GMLIB_VERSION_TO_STRING(GMLIB_VERSION_MAJOR) "." GMLIB_VERSION_TO_STRING(
GMLIB_VERSION_MINOR
) "." GMLIB_VERSION_TO_STRING(GMLIB_VERSION_PATCH); ) "." GMLIB_VERSION_TO_STRING(GMLIB_VERSION_PATCH);
}); });
RemoteCall::exportAs( RemoteCall::exportAs(
@@ -199,7 +201,7 @@ void Export_Compatibility_API() {
} }
}); });
RemoteCall::exportAs("GMLIB_API", "getPlayerPosition", [](std::string const& uuid) -> std::pair<BlockPos, int> { RemoteCall::exportAs("GMLIB_API", "getPlayerPosition", [](std::string const& uuid) -> std::pair<BlockPos, int> {
if (auto player = OfflinePlayer::getOfflinePlayer(mce::UUID::fromString(uuid))) { if (auto player = OfflinePlayer::fromUuid(mce::UUID::fromString(uuid))) {
if (auto pos = player->getPlayerPosition()) { if (auto pos = player->getPlayerPosition()) {
return *pos; return *pos;
} }
@@ -213,7 +215,7 @@ void Export_Compatibility_API() {
"GMLIB_API", "GMLIB_API",
"setPlayerPosition", "setPlayerPosition",
[](std::string const& uuid, std::pair<BlockPos, int> pos) -> bool { [](std::string const& uuid, std::pair<BlockPos, int> pos) -> bool {
if (auto player = OfflinePlayer::getOfflinePlayer(mce::UUID::fromString(uuid))) { if (auto player = OfflinePlayer::fromUuid(mce::UUID::fromString(uuid))) {
return player->setPosition(pos.first, pos.second); return player->setPosition(pos.first, pos.second);
} }
return false; return false;
@@ -474,33 +476,29 @@ void Export_Compatibility_API() {
} }
); );
RemoteCall::exportAs("GMLIB_API", "getXuidByUuid", [](std::string const& uuid) -> std::string { RemoteCall::exportAs("GMLIB_API", "getXuidByUuid", [](std::string const& uuid) -> std::string {
return UserCache::getXuidByUuid(mce::UUID::fromString(uuid)).value_or(""); return UserCache::getInstance()->from(mce::UUID::fromString(uuid))->mXuid;
}); });
RemoteCall::exportAs("GMLIB_API", "getXuidByName", [](std::string const& name) -> std::string { RemoteCall::exportAs("GMLIB_API", "getXuidByName", [](std::string const& name) -> std::string {
return UserCache::getXuidByName(name).value_or(""); return UserCache::getInstance()->from(name)->mXuid;
}); });
RemoteCall::exportAs("GMLIB_API", "getNameByUuid", [](std::string const& uuid) -> std::string { RemoteCall::exportAs("GMLIB_API", "getNameByUuid", [](std::string const& uuid) -> std::string {
return UserCache::getNameByUuid(mce::UUID::fromString(uuid)).value_or(""); return UserCache::getInstance()->from(mce::UUID::fromString(uuid))->mName;
}); });
RemoteCall::exportAs("GMLIB_API", "getNameByXuid", [](std::string const& xuid) -> std::string { RemoteCall::exportAs("GMLIB_API", "getNameByXuid", [](std::string const& xuid) -> std::string {
return UserCache::getNameByXuid(xuid).value_or(""); return UserCache::getInstance()->from(xuid, UserCache::QueryType::Xuid)->mName;
}); });
RemoteCall::exportAs("GMLIB_API", "getUuidByXuid", [](std::string const& xuid) -> std::string { RemoteCall::exportAs("GMLIB_API", "getUuidByXuid", [](std::string const& xuid) -> std::string {
return UserCache::getUuidByXuid(xuid).transform( return UserCache::getInstance()->from(xuid, UserCache::QueryType::Xuid)->mUuid.asString();
[](mce::UUID&& uuid) -> std::string { return uuid.asString(); }
).value_or("");
}); });
RemoteCall::exportAs("GMLIB_API", "getUuidByName", [](std::string const& name) -> std::string { RemoteCall::exportAs("GMLIB_API", "getUuidByName", [](std::string const& name) -> std::string {
return UserCache::getUuidByName(name).transform( return UserCache::getInstance()->from(name)->mUuid.asString();
[](mce::UUID&& uuid) -> std::string { return uuid.asString(); }
).value_or("");
}); });
RemoteCall::exportAs( RemoteCall::exportAs(
"GMLIB_API", "GMLIB_API",
"getAllPlayerInfo", "getAllPlayerInfo",
[]() -> std::vector<std::unordered_map<std::string, std::string>> { []() -> std::vector<std::unordered_map<std::string, std::string>> {
std::vector<std::unordered_map<std::string, std::string>> result; std::vector<std::unordered_map<std::string, std::string>> result;
for (auto entry : UserCache::entries()) { for (auto entry : UserCache::getInstance()->entries()) {
result.push_back({ result.push_back({
{"Name", entry.mName }, {"Name", entry.mName },
{"Xuid", entry.mXuid }, {"Xuid", entry.mXuid },
@@ -611,21 +609,21 @@ void Export_Compatibility_API() {
result.push_back({ result.push_back({
{"Name", gameRule.mName }, {"Name", gameRule.mName },
{"Type", "Bool" }, {"Type", "Bool" },
{"Value", std::to_string(gameRule.mValue->mUnk29fff1.as<bool>())} {"Value", std::to_string(gameRule.mValue->boolVal)}
}); });
break; break;
case GameRule::Type::Float: case GameRule::Type::Float:
result.push_back({ result.push_back({
{"Name", gameRule.mName }, {"Name", gameRule.mName },
{"Type", "Float" }, {"Type", "Float" },
{"Value", std::to_string(gameRule.mValue->mUnk768db5.as<float>())} {"Value", std::to_string(gameRule.mValue->floatVal)}
}); });
break; break;
case GameRule::Type::Int: case GameRule::Type::Int:
result.push_back({ result.push_back({
{"Name", gameRule.mName }, {"Name", gameRule.mName },
{"Type", "Int" }, {"Type", "Int" },
{"Value", std::to_string(gameRule.mValue->mUnk2ab4f3.as<int>())} {"Value", std::to_string(gameRule.mValue->intVal)}
}); });
break; break;
case GameRule::Type::Invalid: case GameRule::Type::Invalid:
@@ -803,7 +801,7 @@ void Export_Compatibility_API() {
return magic_enum::enum_name(container->mContainerType).data(); return magic_enum::enum_name(container->mContainerType).data();
}); });
RemoteCall::exportAs("GMLIB_API", "hasPlayerNbt", [](std::string const& uuid) -> bool { RemoteCall::exportAs("GMLIB_API", "hasPlayerNbt", [](std::string const& uuid) -> bool {
return OfflinePlayer::getOfflinePlayer(mce::UUID::fromString(uuid)) return OfflinePlayer::fromUuid(mce::UUID::fromString(uuid))
.transform([&](auto&& player) -> bool { return player.hasNbt(); }) .transform([&](auto&& player) -> bool { return player.hasNbt(); })
.value_or(false); .value_or(false);
}); });
@@ -951,4 +949,7 @@ void Export_Compatibility_API() {
RemoteCall::exportAs("GMLIB_API", "getEntityTypeId", [](Actor* entity) -> int { RemoteCall::exportAs("GMLIB_API", "getEntityTypeId", [](Actor* entity) -> int {
return (int)entity->getEntityTypeId(); return (int)entity->getEntityTypeId();
}); });
RemoteCall::exportAs("GMLIB_API", "getPlayerProtocolVersion", [](Player* player) -> int {
return ((GMPlayer*)player)->getNetworkProtocolVersion();
});
} }
+6 -7
View File
@@ -1,10 +1,10 @@
#include "Global.h" #include "Global.h"
std::unordered_set<std::string> HardCodedKeys = {"AlwaysUnlocked", "PlayerHasManyItems", "PlayerInWater", "None"};
ICustomRecipe::UnlockingRequirement makeRecipeUnlockingKey(std::string const& key) { ICustomRecipe::UnlockingRequirement makeRecipeUnlockingKey(std::string const& key) {
if (HardCodedKeys.count(key)) return {{ICustomRecipe::Ingredient{key}}}; if (auto context = magic_enum::enum_cast<RecipeUnlockingContext>(key)) {
return ICustomRecipe::UnlockingRequirement({ICustomRecipe::Ingredient(key, 1, 0)}); return ICustomRecipe::UnlockingRequirement(*context);
}
return ICustomRecipe::UnlockingRequirement({ICustomRecipe::Ingredient(key)});
} }
void Export_Legacy_GMLib_ModAPI() { void Export_Legacy_GMLib_ModAPI() {
@@ -37,9 +37,9 @@ void Export_Legacy_GMLib_ModAPI() {
std::string const& unlock) -> void { std::string const& unlock) -> void {
if (!GMLevel::getInstance().has_value()) return; if (!GMLevel::getInstance().has_value()) return;
ICustomShapedRecipe::ShapedIngredients types; ICustomShapedRecipe::ShapedIngredients types;
char index = 'a'; char index = 'A';
for (auto& ing : ingredients) { for (auto& ing : ingredients) {
types.add(std::string{index++}, ICustomRecipe::Ingredient{ing, 1}); types.add(std::string(1, index++), ICustomRecipe::Ingredient{ing});
} }
CustomRecipeRegistry::getInstance().registerShapedRecipe( CustomRecipeRegistry::getInstance().registerShapedRecipe(
recipe_id, recipe_id,
@@ -48,7 +48,6 @@ void Export_Legacy_GMLib_ModAPI() {
ItemInstance(result, count), ItemInstance(result, count),
makeRecipeUnlockingKey(unlock) makeRecipeUnlockingKey(unlock)
); );
} }
); );
RemoteCall::exportAs( RemoteCall::exportAs(
+1 -1
View File
@@ -70,7 +70,7 @@ void Export_Legacy_GMLib_ServerAPI() {
} }
); );
RemoteCall::exportAs("GMLib_ServerAPI", "removeFakeList", [](const std::string& nameOrXuid) -> bool { RemoteCall::exportAs("GMLib_ServerAPI", "removeFakeList", [](const std::string& nameOrXuid) -> bool {
PlayerListAPI::resetListName(nameOrXuid); PlayerListAPI::erase(nameOrXuid);
return true; return true;
}); });
RemoteCall::exportAs("GMLib_ServerAPI", "removeAllFakeList", []() -> void { PlayerListAPI::clear(); }); RemoteCall::exportAs("GMLib_ServerAPI", "removeAllFakeList", []() -> void { PlayerListAPI::clear(); });
+32 -12
View File
@@ -23,10 +23,14 @@ void registerPlayerPlaceholder(
[Call = RemoteCall::importAs<std::string(Player * pl, std::unordered_map<std::string, std::string>)>( [Call = RemoteCall::importAs<std::string(Player * pl, std::unordered_map<std::string, std::string>)>(
PluginName, PluginName,
FuncName FuncName
)](optional_ref<GMActor> actor, std::unordered_map<std::string, std::string> const& params, auto&&... )](optional_ref<Actor> actor, ll::StringMap<std::string> const& params, auto&&...
) -> std::optional<std::string> { ) -> std::optional<std::string> {
if (actor.has_value() && ((Actor*)actor.as_ptr())->isPlayer()) { if (actor.has_value() && ((Actor*)actor.as_ptr())->isPlayer()) {
return Call((Player*)actor.as_ptr(), params); std::unordered_map<std::string, std::string> paramMap;
for (auto& [key, val] : params) {
paramMap[key] = val;
}
return Call((Player*)actor.as_ptr(), paramMap);
} }
return std::nullopt; return std::nullopt;
}, },
@@ -55,8 +59,13 @@ void registerServerPlaceholder(
[Call = RemoteCall::importAs<std::string(std::unordered_map<std::string, std::string>)>( [Call = RemoteCall::importAs<std::string(std::unordered_map<std::string, std::string>)>(
PluginName, PluginName,
FuncName FuncName
)](auto, std::unordered_map<std::string, std::string> const& params, auto&&... )](auto, ll::StringMap<std::string> const& params, auto&&...) -> std::optional<std::string> {
) -> std::optional<std::string> { return Call(params); }, std::unordered_map<std::string, std::string> paramMap;
for (auto& [key, val] : params) {
paramMap[key] = val;
}
return Call(paramMap);
},
mod mod
); );
}; };
@@ -80,8 +89,8 @@ void registerStaticPlaceholder(
if (mod.expired()) return; if (mod.expired()) return;
PlaceholderAPI::registerPlaceholder( PlaceholderAPI::registerPlaceholder(
PAPIName, PAPIName,
[Call = RemoteCall::importAs<std::string()>(PluginName, FuncName)](auto&&... [Call = RemoteCall::importAs<std::string()>(PluginName, FuncName)](auto&&...)
) -> std::optional<std::string> { return Call(); }, -> std::optional<std::string> { return Call(); },
mod mod
); );
}; };
@@ -128,10 +137,13 @@ void registerPlaceholder(std::string const& placeholder, std::string const& func
std::string(Actor*, std::unordered_map<std::string, std::string>, std::string)>( std::string(Actor*, std::unordered_map<std::string, std::string>, std::string)>(
pluginName, pluginName,
funcName funcName
)](optional_ref<GMActor> actor, )](optional_ref<Actor> actor, ll::StringMap<std::string> const& params, std::string const& language
std::unordered_map<std::string, std::string> const& params, ) -> std::optional<std::string> {
std::string const& language) -> std::optional<std::string> { std::unordered_map<std::string, std::string> paramMap;
auto result = Call((Actor*)actor.as_ptr(), params, language); for (auto& [key, val] : params) {
paramMap[key] = val;
}
auto result = Call((Actor*)actor.as_ptr(), paramMap, language);
return result == "<std::nullopt>" ? std::nullopt : std::optional(result); return result == "<std::nullopt>" ? std::nullopt : std::optional(result);
}, },
mod mod
@@ -157,7 +169,11 @@ std::string getValue(
std::unordered_map<std::string, std::string> params, std::unordered_map<std::string, std::string> params,
std::string const& language std::string const& language
) { ) {
return PlaceholderAPI::getValue(placeholder, std::nullopt, params, language).value_or("<std::nullopt>"); ll::StringMap<std::string> paramMap;
for (auto& [key, val] : params) {
paramMap[key] = val;
}
return PlaceholderAPI::getValue(placeholder, std::nullopt, paramMap, language).value_or("<std::nullopt>");
} }
std::string getValueFromActor( std::string getValueFromActor(
std::string const& placeholder, std::string const& placeholder,
@@ -165,7 +181,11 @@ std::string getValueFromActor(
std::unordered_map<std::string, std::string> params, std::unordered_map<std::string, std::string> params,
std::string const& language std::string const& language
) { ) {
return PlaceholderAPI::getValue(placeholder, (GMActor*)actor, params, language).value_or("<std::nullopt>"); ll::StringMap<std::string> paramMap;
for (auto& [key, val] : params) {
paramMap[key] = val;
}
return PlaceholderAPI::getValue(placeholder, (GMActor*)actor, paramMap, language).value_or("<std::nullopt>");
} }
} // namespace NewPapiRemoteCall } // namespace NewPapiRemoteCall
+3 -3
View File
@@ -2,7 +2,7 @@
"format_version": 3, "format_version": 3,
"format_uuid": "289f771f-2c9a-4d73-9f3f-8492495a924d", "format_uuid": "289f771f-2c9a-4d73-9f3f-8492495a924d",
"tooth": "github.com/GroupMountain/GMLIB-LegacyRemoteCallApi", "tooth": "github.com/GroupMountain/GMLIB-LegacyRemoteCallApi",
"version": "1.0.0", "version": "1.1.1",
"info": { "info": {
"name": "GMLIB-LegacyRemoteCallApi", "name": "GMLIB-LegacyRemoteCallApi",
"description": "Legacy RemoteCall API for GMLIB", "description": "Legacy RemoteCall API for GMLIB",
@@ -20,8 +20,8 @@
"platform": "win-x64", "platform": "win-x64",
"dependencies": { "dependencies": {
"github.com/LiteLDev/LeviLamina": ">=1.1.1", "github.com/LiteLDev/LeviLamina": ">=1.1.1",
"github.com/GroupMountain/GMLIB-Release": ">=1.0.0", "github.com/GroupMountain/GMLIB-Release": ">=1.2.0-rc.1",
"github.com/MiracleForest/iListenAttentively-Release": ">=0.4.1" "github.com/MiracleForest/iListenAttentively-Release": ">=0.5.0-rc.1"
}, },
"assets": [ "assets": [
{ {
+3 -3
View File
@@ -8,11 +8,11 @@ if not has_config("vs_runtime") then
set_runtimes("MD") set_runtimes("MD")
end end
add_requires("levilamina", {configs = {target_type = "server"}}) add_requires("levilamina 1.2.0", {configs = {target_type = "server"}})
add_requires("legacyremotecall") add_requires("legacyremotecall")
add_requires("levibuildscript") add_requires("levibuildscript")
add_requires("ilistenattentively") add_requires("ilistenattentively 0.5.0-rc.1")
add_requires("gmlib") add_requires("gmlib 1.2.0-rc.1")
target("GMLIB-LegacyRemoteCallApi") target("GMLIB-LegacyRemoteCallApi")
add_cxflags( add_cxflags(