删除和修改
删除新增的handleRequestTryAction事件和handleRequestAction事件 有关附魔接口均改采用命名空间 新增id转命名空间接口 修正获取最大玩家数代码
This commit is contained in:
+33
-21
@@ -264,22 +264,24 @@ const GMLIB_API = {
|
||||
getBlockLightEmission: ll.import("GMLIB_API", "getBlockLightEmission"),
|
||||
/** 获取游戏规则列表 @type {function():Array.<{Name:string,Value:string,Type:"Bool"|"Float"|"Int"}>} */
|
||||
getGameRules: ll.import("GMLIB_API", "getGameRules"),
|
||||
/** 获取物品可以拥有的附魔 @type {function(Item):Array.<number>} */
|
||||
/** 获取物品可以拥有的附魔 @type {function(Item):Array.<string>} */
|
||||
getLegalEnchants: ll.import("GMLIB_API", "getLegalEnchants"),
|
||||
/** 给物品添加附魔 @type {function(Item,number,number,boolean):boolean} */
|
||||
/** 给物品添加附魔 @type {function(Item,string,number,boolean):boolean} */
|
||||
applyEnchant: ll.import("GMLIB_API", "applyEnchant"),
|
||||
/** 删除物品所有附魔 @type {function(Item):void} */
|
||||
removeEnchants: ll.import("GMLIB_API", "removeEnchants"),
|
||||
/** 判断物品是否拥有附魔 @type {function(Item,number):boolean} */
|
||||
/** 判断物品是否拥有附魔 @type {function(Item,string):boolean} */
|
||||
hasEnchant: ll.import("GMLIB_API", "hasEnchant"),
|
||||
/** 获取附魔等级 @type {function(Item,number):number} */
|
||||
/** 获取附魔等级 @type {function(Item,string):number} */
|
||||
getEnchantLevel: ll.import("GMLIB_API", "getEnchantLevel"),
|
||||
/** 获取附魔名字 @type {function(number,number):number} */
|
||||
/** 获取附魔名字 @type {function(string,number):number} */
|
||||
getEnchantNameAndLevel: ll.import("GMLIB_API", "getEnchantNameAndLevel"),
|
||||
/** 通过ID获取附魔命名空间 @type {function(number):string} */
|
||||
getEnchantTypeNameFromId: ll.import("GMLIB_API", "getEnchantTypeNameFromId"),
|
||||
/** 获取最大玩家数 @type {function():number} */
|
||||
getMaxPlayers:ll.import("GMLIB_ServerAPI","getMaxPlayers"),
|
||||
getMaxPlayers: ll.import("GMLib_ServerAPI", "getMaxPlayers"),
|
||||
/** 丢出玩家背包内物品 @type {function(Player,Item,boolean):boolean} */
|
||||
dropPlayerItem:ll.import("GMLIB_API","dropPlayerItem")
|
||||
dropPlayerItem: ll.import("GMLIB_API", "dropPlayerItem")
|
||||
}
|
||||
|
||||
/** 静态悬浮字类列表 @type {Map<number,StaticFloatingText>} */
|
||||
@@ -935,19 +937,29 @@ class Minecraft {
|
||||
|
||||
/**
|
||||
* 获取附魔名字和等级
|
||||
* @param {number} id 附魔ID
|
||||
* @param {string} typeName 附魔的命名空间
|
||||
* @param {number} level 附魔等级
|
||||
* @returns {string} 文本
|
||||
*/
|
||||
static getEnchantNameAndLevel(id, level) {
|
||||
return GMLIB_API.getEnchantNameAndLevel(id, level);
|
||||
static getEnchantNameAndLevel(typeName, level) {
|
||||
return GMLIB_API.getEnchantNameAndLevel(typeName, level);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过附魔ID获取附魔命名空间
|
||||
* @param {number} id 附魔ID
|
||||
* @returns {string?} 附魔的命名空间
|
||||
*/
|
||||
static getEnchantTypeNameFromId(id) {
|
||||
const result = GMLIB_API.getEnchantTypeNameFromId(id);
|
||||
return result === "" ? null : result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取最大玩家数量
|
||||
* @returns {number} 最大玩家数量
|
||||
*/
|
||||
static getMaxPlayers(){
|
||||
static getMaxPlayers() {
|
||||
return GMLIB_API.getMaxPlayers();
|
||||
}
|
||||
}
|
||||
@@ -2111,7 +2123,7 @@ LLSE_Player.prototype.pullInEntity =
|
||||
LLSE_Item.prototype.getLegalEnchants =
|
||||
/**
|
||||
* 获取物品可以拥有的合法附魔
|
||||
* @returns {Array.<number>} 附魔ID列表
|
||||
* @returns {Array.<string>} 附魔ID列表
|
||||
*/
|
||||
function () {
|
||||
return GMLIB_API.getLegalEnchants(this);
|
||||
@@ -2120,13 +2132,13 @@ LLSE_Item.prototype.getLegalEnchants =
|
||||
LLSE_Item.prototype.applyEnchant =
|
||||
/**
|
||||
* 添加附魔
|
||||
* @param {number} id 附魔ID
|
||||
* @param {string} typeName 附魔的命名空间
|
||||
* @param {number} level 等级
|
||||
* @param {boolean} allowNonVanilla 允许非原版附魔
|
||||
* @returns {boolean} 是否附魔成功
|
||||
*/
|
||||
function (id, level, allowNonVanilla = true) {
|
||||
return GMLIB_API.applyEnchant(this, id, level, allowNonVanilla);
|
||||
function (typeName, level, allowNonVanilla = true) {
|
||||
return GMLIB_API.applyEnchant(this, typeName, level, allowNonVanilla);
|
||||
}
|
||||
|
||||
LLSE_Item.prototype.removeEnchants =
|
||||
@@ -2140,21 +2152,21 @@ LLSE_Item.prototype.removeEnchants =
|
||||
LLSE_Item.prototype.hasEnchant =
|
||||
/**
|
||||
* 判断是否拥有附魔
|
||||
* @param {number} id 附魔ID
|
||||
* @param {number} typeName 附魔的命名空间
|
||||
* @returns {boolean} 是否拥有附魔
|
||||
*/
|
||||
function (id) {
|
||||
return GMLIB_API.hasEnchant(this, id);
|
||||
function (typeName) {
|
||||
return GMLIB_API.hasEnchant(this, typeName);
|
||||
}
|
||||
|
||||
LLSE_Item.prototype.getEnchantLevel =
|
||||
/**
|
||||
* 获取附魔等级
|
||||
* @param {number} id 附魔ID
|
||||
* @param {number} typeName 附魔ID
|
||||
* @returns {number} 附魔等级
|
||||
*/
|
||||
function (id) {
|
||||
return GMLIB_API.getEnchantLevel(this, id);
|
||||
function (typeName) {
|
||||
return GMLIB_API.getEnchantLevel(this, typeName);
|
||||
}
|
||||
|
||||
LLSE_Player.prototype.dropItem =
|
||||
|
||||
Reference in New Issue
Block a user