增加6个接口
- ItemisUnbreakable - setItemUnbreakable - getItemShouldKeepOnDeath - setItemShouldKeepOnDeath - getItemLockMode - setItemLockMode
This commit is contained in:
Vendored
+37
-6
@@ -785,6 +785,7 @@ declare class JsonConfig {
|
|||||||
): void;
|
): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** JSON语言文件 */
|
||||||
declare class JsonLanguage extends JsonConfig {
|
declare class JsonLanguage extends JsonConfig {
|
||||||
/** 创建或打开一个 Json 语言文件 */
|
/** 创建或打开一个 Json 语言文件 */
|
||||||
constructor(
|
constructor(
|
||||||
@@ -803,6 +804,7 @@ declare class JsonLanguage extends JsonConfig {
|
|||||||
): string;
|
): string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** JSON版翻译类 */
|
||||||
declare class JsonI18n {
|
declare class JsonI18n {
|
||||||
/** 加载翻译数据目录 */
|
/** 加载翻译数据目录 */
|
||||||
constructor(
|
constructor(
|
||||||
@@ -895,6 +897,7 @@ declare class Version {
|
|||||||
static getGmlibVersion(): Version;
|
static getGmlibVersion(): Version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 翻译API类 */
|
||||||
declare class I18nAPI {
|
declare class I18nAPI {
|
||||||
private constructor();
|
private constructor();
|
||||||
|
|
||||||
@@ -955,6 +958,7 @@ declare class I18nAPI {
|
|||||||
): void;
|
): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 玩家信息存储类 */
|
||||||
declare class UserCache {
|
declare class UserCache {
|
||||||
private constructor();
|
private constructor();
|
||||||
|
|
||||||
@@ -1020,7 +1024,7 @@ interface Player {
|
|||||||
/** (GMLIB)清除玩家重生点 */
|
/** (GMLIB)清除玩家重生点 */
|
||||||
clearSpawnPoint(): void;
|
clearSpawnPoint(): void;
|
||||||
|
|
||||||
/** 丢出玩家物品 */
|
/** (GMLIB)丢出玩家物品 */
|
||||||
dropItem(
|
dropItem(
|
||||||
/** 物品对象 */
|
/** 物品对象 */
|
||||||
item: Item,
|
item: Item,
|
||||||
@@ -1144,10 +1148,10 @@ interface Item {
|
|||||||
block: Block
|
block: Block
|
||||||
): boolean;
|
): boolean;
|
||||||
|
|
||||||
/** 获取物品可以拥有的附魔 */
|
/** (GMLIB)获取物品可以拥有的附魔 */
|
||||||
getLegalEnchants(): string[]
|
getLegalEnchants(): string[]
|
||||||
|
|
||||||
/** 添加附魔 */
|
/** (GMLIB)添加附魔 */
|
||||||
applyEnchant(
|
applyEnchant(
|
||||||
/** 附魔的命名空间 */
|
/** 附魔的命名空间 */
|
||||||
typeName: string,
|
typeName: string,
|
||||||
@@ -1157,18 +1161,45 @@ interface Item {
|
|||||||
allowNonVanilla: boolean | null
|
allowNonVanilla: boolean | null
|
||||||
): boolean;
|
): boolean;
|
||||||
|
|
||||||
/** 删除所有附魔 */
|
/** (GMLIB)删除所有附魔 */
|
||||||
removeEnchants(): void;
|
removeEnchants(): void;
|
||||||
|
|
||||||
/** 判断是否拥有附魔 */
|
/** (GMLIB)判断是否拥有附魔 */
|
||||||
hasEnchant(
|
hasEnchant(
|
||||||
/** 附魔的命名空间 */
|
/** 附魔的命名空间 */
|
||||||
typeName: string
|
typeName: string
|
||||||
): boolean;
|
): boolean;
|
||||||
|
|
||||||
/** 获取附魔等级 */
|
/** (GMLIB)获取附魔等级 */
|
||||||
getEnchantLevel(
|
getEnchantLevel(
|
||||||
/** 附魔的命名空间 */
|
/** 附魔的命名空间 */
|
||||||
typeName: string
|
typeName: string
|
||||||
): number;
|
): number;
|
||||||
|
|
||||||
|
/** (GMLIB)物品是否拥有不可破坏标签 */
|
||||||
|
isUnbreakable(): boolean;
|
||||||
|
|
||||||
|
/** (GMLIB)设置物品不可破坏标签 */
|
||||||
|
setUnbreakable(
|
||||||
|
/** 是否不可破坏 */
|
||||||
|
unbreakable: boolean
|
||||||
|
): void;
|
||||||
|
|
||||||
|
/** (GMLIB)物品是否拥有死亡不掉落标签 */
|
||||||
|
getShouldKeepOnDeath(): boolean;
|
||||||
|
|
||||||
|
/** (GMLIB)设置物品死亡不掉落标签 */
|
||||||
|
setShouldKeepOnDeath(
|
||||||
|
/** 物品是否死亡不掉落 */
|
||||||
|
value: boolean
|
||||||
|
): void;
|
||||||
|
|
||||||
|
/** (GMLIB)获取物品的锁定模式 0:无 1:锁定在格子里 2:锁定在背包里 */
|
||||||
|
getItemLockMode(): 0 | 1 | 2;
|
||||||
|
|
||||||
|
/** (GMLIB)设置物品的锁定模式 0:无 1:锁定在格子里 2:锁定在背包里 */
|
||||||
|
setItemLockMode(
|
||||||
|
/** 锁定模式 */
|
||||||
|
mode: 0 | 1 | 2
|
||||||
|
): void;
|
||||||
}
|
}
|
||||||
+67
-1
@@ -289,7 +289,19 @@ const GMLIB_API = {
|
|||||||
/** 获取实体的RuntimeId @type {function(Entity):number} */
|
/** 获取实体的RuntimeId @type {function(Entity):number} */
|
||||||
getEntityRuntimeId: ll.import("GMLIB_API", "getEntityRuntimeId"),
|
getEntityRuntimeId: ll.import("GMLIB_API", "getEntityRuntimeId"),
|
||||||
/** 获取实体命名 @type {function(Entity):string} */
|
/** 获取实体命名 @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>} */
|
/** 静态悬浮字类列表 @type {Map<number,StaticFloatingText>} */
|
||||||
@@ -2215,6 +2227,60 @@ LLSE_Entity.prototype.getNameTag =
|
|||||||
return GMLIB_API.getEntityNameTag(this);
|
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 = {
|
module.exports = {
|
||||||
StaticFloatingText,
|
StaticFloatingText,
|
||||||
DynamicFloatingText,
|
DynamicFloatingText,
|
||||||
|
|||||||
@@ -780,4 +780,22 @@ void Export_Compatibility_API() {
|
|||||||
RemoteCall::exportAs("GMLIB_API", "getEntityNameTag", [](Actor* entity) -> std::string {
|
RemoteCall::exportAs("GMLIB_API", "getEntityNameTag", [](Actor* entity) -> std::string {
|
||||||
return entity->getNameTag();
|
return entity->getNameTag();
|
||||||
});
|
});
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "ItemisUnbreakable", [](ItemStack const* item) -> bool {
|
||||||
|
return ((GMLIB_ItemStack*)item)->isUnbreakable();
|
||||||
|
});
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "setItemUnbreakable", [](ItemStack const* item, bool value) -> void {
|
||||||
|
((GMLIB_ItemStack*)item)->setUnbreakable(value);
|
||||||
|
});
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "getItemShouldKeepOnDeath", [](ItemStack const* item) -> bool {
|
||||||
|
return ((GMLIB_ItemStack*)item)->getShouldKeepOnDeath();
|
||||||
|
});
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "setItemShouldKeepOnDeath", [](ItemStack const* item, bool value) -> void {
|
||||||
|
((GMLIB_ItemStack*)item)->setShouldKeepOnDeath(true);
|
||||||
|
});
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "getItemLockMode", [](ItemStack const* item) -> int {
|
||||||
|
return (int)((GMLIB_ItemStack*)item)->getItemLockMode();
|
||||||
|
});
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "setItemLockMode", [](ItemStack const* item, int value) -> void {
|
||||||
|
((GMLIB_ItemStack*)item)->setItemLockMode((ItemLockMode)value);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user