添加getItemMaxCount接口
This commit is contained in:
Vendored
+3
@@ -1283,6 +1283,9 @@ interface Item {
|
|||||||
|
|
||||||
/** (GMLIB)物品是否为食物 */
|
/** (GMLIB)物品是否为食物 */
|
||||||
isFood(): boolean;
|
isFood(): boolean;
|
||||||
|
|
||||||
|
/** (GMLIB)获取物品最大堆叠数量 */
|
||||||
|
getMaxCount(): number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Container {
|
interface Container {
|
||||||
|
|||||||
+13
-1
@@ -337,7 +337,9 @@ const GMLIB_API = {
|
|||||||
/** 获取容器类型 @type {function(Container):string} */
|
/** 获取容器类型 @type {function(Container):string} */
|
||||||
getContainerType: ll.import("GMLIB_API", "getContainerType"),
|
getContainerType: ll.import("GMLIB_API", "getContainerType"),
|
||||||
/** 玩家是否拥有NBT @type {function(string):boolean} */
|
/** 玩家是否拥有NBT @type {function(string):boolean} */
|
||||||
hasPlayerNbt: ll.import("GMLIB_API", "hasPlayerNbt")
|
hasPlayerNbt: ll.import("GMLIB_API", "hasPlayerNbt"),
|
||||||
|
/** 获取物品最大堆叠数量 @type {function(Item):number} */
|
||||||
|
getItemMaxCount: ll.import("GMLIB_API", "getItemMaxCount")
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 静态悬浮字类列表 @type {Map<number,StaticFloatingText>} */
|
/** 静态悬浮字类列表 @type {Map<number,StaticFloatingText>} */
|
||||||
@@ -2487,11 +2489,21 @@ LLSE_Player.prototype.sendInventorySlotPacket =
|
|||||||
LLSE_Container.prototype.getContainerType =
|
LLSE_Container.prototype.getContainerType =
|
||||||
/**
|
/**
|
||||||
* 获取容器类型
|
* 获取容器类型
|
||||||
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
function () {
|
function () {
|
||||||
return GMLIB_API.getContainerType(this);
|
return GMLIB_API.getContainerType(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LLSE_Item.prototype.getMaxCount =
|
||||||
|
/**
|
||||||
|
* 获取物品最大堆叠数量
|
||||||
|
* @returns {number}
|
||||||
|
*/
|
||||||
|
function () {
|
||||||
|
return GMLIB_API.getItemMaxCount(this);
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
StaticFloatingText,
|
StaticFloatingText,
|
||||||
DynamicFloatingText,
|
DynamicFloatingText,
|
||||||
|
|||||||
@@ -870,7 +870,7 @@ void Export_Compatibility_API() {
|
|||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
"GMLIB_API",
|
"GMLIB_API",
|
||||||
"sendInventorySlotPacket",
|
"sendInventorySlotPacket",
|
||||||
[](Player* player, int containerId, int slot, ItemStack* item) -> void {
|
[](Player* player, int containerId, int slot, ItemStack const* item) -> void {
|
||||||
InventorySlotPacket((ContainerID)containerId, slot, *item).sendTo(*player);
|
InventorySlotPacket((ContainerID)containerId, slot, *item).sendTo(*player);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -881,4 +881,7 @@ void Export_Compatibility_API() {
|
|||||||
auto uid = mce::UUID::fromString(uuid);
|
auto uid = mce::UUID::fromString(uuid);
|
||||||
return GMLIB_Player::getPlayerNbt(uid) ? true : false;
|
return GMLIB_Player::getPlayerNbt(uid) ? true : false;
|
||||||
});
|
});
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "getItemMaxCount", [](ItemStack const* item) -> int {
|
||||||
|
return item->getMaxStackSize();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user