增加6个接口

- ItemisUnbreakable
- setItemUnbreakable
- getItemShouldKeepOnDeath
- setItemShouldKeepOnDeath
- getItemLockMode
- setItemLockMode
This commit is contained in:
子沐呀
2024-07-11 03:50:50 +08:00
Unverified
parent a5fe6c5a39
commit 4dce1f7a8b
3 changed files with 122 additions and 7 deletions
+67 -1
View File
@@ -289,7 +289,19 @@ const GMLIB_API = {
/** 获取实体的RuntimeId @type {function(Entity):number} */
getEntityRuntimeId: ll.import("GMLIB_API", "getEntityRuntimeId"),
/** 获取实体命名 @type {function(Entity):string} */
getEntityNameTag: ll.import("GMLIB_API", "getEntityNameTag")
getEntityNameTag: ll.import("GMLIB_API", "getEntityNameTag"),
/** 物品是否有不可破坏标签 @type {function(Item):boolean} */
ItemisUnbreakable: ll.import("GMLIB_API", "ItemisUnbreakable"),
/** 设置物品不可破坏标签 @type {function(Item,boolean):void} */
setItemUnbreakable: ll.import("GMLIB_API", "setItemUnbreakable"),
/** 物品是否死亡不会掉落 @type {function(Item):boolean} */
getItemShouldKeepOnDeath: ll.import("GMLIB_API", "getItemShouldKeepOnDeath"),
/** 设置物品死亡不掉落 @type {function(Item,boolean):void} */
setItemShouldKeepOnDeath: ll.import("GMLIB_API", "setItemShouldKeepOnDeath"),
/** 获取物品锁定模式 @type {function(Item):number} */
getItemLockMode: ll.import("GMLIB_API", "getItemLockMode"),
/** 设置物品锁定模式 @type {function(Item,number):void} */
setItemLockMode: ll.import("GMLIB_API", "setItemLockMode")
}
/** 静态悬浮字类列表 @type {Map<number,StaticFloatingText>} */
@@ -2215,6 +2227,60 @@ LLSE_Entity.prototype.getNameTag =
return GMLIB_API.getEntityNameTag(this);
}
LLSE_Item.prototype.isUnbreakable =
/**
* 物品是否拥有不可破坏标签
* @returns {boolean} 是否拥有
*/
function () {
return GMLIB_API.ItemisUnbreakable(this);
}
LLSE_Item.prototype.setUnbreakable =
/**
* 设置物品不可破坏标签
* @param {boolean} value 是否不可破坏
*/
function (value) {
GMLIB_API.setItemUnbreakable(this, value);
}
LLSE_Item.prototype.getShouldKeepOnDeath =
/**
* 物品是否拥有死亡不掉落标签
* @returns {boolean} 物品是否拥有死亡不掉落标签
*/
function () {
return GMLIB_API.getItemShouldKeepOnDeath(this);
}
LLSE_Item.prototype.setShouldKeepOnDeath =
/**
* 设置物品死亡不掉落标签
* @param {boolean} value 物品是否死亡不掉落
*/
function (value) {
GMLIB_API.setItemShouldKeepOnDeath(this, value);
}
LLSE_Item.prototype.getItemLockMode =
/**
* 获取物品的锁定模式
* @returns {0|1|2} 锁定的模式 0:无 1:锁定在格子里 2:锁定在背包里
*/
function () {
return GMLIB_API.getItemLockMode(this)
}
LLSE_Item.prototype.setItemLockMode =
/**
* 设置物品的锁定模式
* @param {0|1|2} mode 锁定的模式 0:无 1:锁定在格子里 2:锁定在背包里
*/
function (mode) {
GMLIB_API.setItemLockMode(this, mode);
}
module.exports = {
StaticFloatingText,
DynamicFloatingText,