1新增 2修复

- 新增getEntityOwnerUniqueId接口
- 修复注册PAPI变量无法使用匿名函数
- 修复注册相同PAPI名字无法重载
This commit is contained in:
子沐呀
2024-07-18 21:39:49 +08:00
Unverified
parent a47f8c729d
commit 52897a25a7
5 changed files with 47 additions and 12 deletions
+15 -3
View File
@@ -318,6 +318,8 @@ const GMLIB_API = {
getPlayerArmorCoverPercentage: ll.import("GMLIB_API", "getPlayerArmorCoverPercentage"),
/** 获取玩家盔甲值 @type {function(Player):number} */
getPlayerArmorValue: ll.import("GMLIB_API", "getPlayerArmorValue"),
/** 获取实体主人的UniqueID @type {function(Entity):Entity} */
getEntityOwnerUniqueId: ll.import("GMLIB_API", "getEntityOwnerUniqueId")
}
/** 静态悬浮字类列表 @type {Map<number,StaticFloatingText>} */
@@ -2357,7 +2359,7 @@ LLSE_Player.prototype.getHungry =
* @returns {number}
*/
function () {
return GMLIB_API.getPlayerHungry(this)
return GMLIB_API.getPlayerHungry(this);
}
LLSE_Player.prototype.getArmorCoverPercentage =
@@ -2366,7 +2368,7 @@ LLSE_Player.prototype.getArmorCoverPercentage =
* @returns {number}
*/
function () {
return GMLIB_API.getPlayerArmorCoverPercentage(this)
return GMLIB_API.getPlayerArmorCoverPercentage(this);
}
LLSE_Player.prototype.getArmorValue =
@@ -2375,7 +2377,17 @@ LLSE_Player.prototype.getArmorValue =
* @returns {number}
*/
function () {
return GMLIB_API.getPlayerArmorValue(this)
return GMLIB_API.getPlayerArmorValue(this);
}
LLSE_Player.prototype.getEntityOwner =
/**
* 获取实体的主人
* @returns {Entity|null}
*/
function () {
const uniqueId = GMLIB_API.getEntityOwnerUniqueId(this);
return uniqueId === -1 ? null : Minecraft.getEntityFromUniqueId(uniqueId);
}
module.exports = {