添加/修改
- 添加entityHasFamily,getPlayerDestroyBlockProgress接口 - 修改6事件名
This commit is contained in:
Vendored
+6
-6
@@ -160,7 +160,7 @@ declare class Event {
|
|||||||
/** 末影龙重生事件 */
|
/** 末影龙重生事件 */
|
||||||
static listen(
|
static listen(
|
||||||
/** 事件名 */
|
/** 事件名 */
|
||||||
event: "DragonRespawn",
|
event: "onDragonRespawn",
|
||||||
/** 回调函数 */
|
/** 回调函数 */
|
||||||
listener: (
|
listener: (
|
||||||
/** 末影龙重生后的UniqueID */
|
/** 末影龙重生后的UniqueID */
|
||||||
@@ -171,7 +171,7 @@ declare class Event {
|
|||||||
/** 弹射物实体尝试创建 */
|
/** 弹射物实体尝试创建 */
|
||||||
static listen(
|
static listen(
|
||||||
/** 事件名 */
|
/** 事件名 */
|
||||||
event: "ProjectileTryCreate",
|
event: "onProjectileTryCreate",
|
||||||
/** 回调函数 */
|
/** 回调函数 */
|
||||||
listener: (
|
listener: (
|
||||||
/** 弹射物实体对象 */
|
/** 弹射物实体对象 */
|
||||||
@@ -184,7 +184,7 @@ declare class Event {
|
|||||||
/** 弹射物实体成功后(不可拦截) */
|
/** 弹射物实体成功后(不可拦截) */
|
||||||
static listen(
|
static listen(
|
||||||
/** 事件名 */
|
/** 事件名 */
|
||||||
event: "ProjectileCreate",
|
event: "onProjectileCreate",
|
||||||
/** 回调函数 */
|
/** 回调函数 */
|
||||||
listener: (
|
listener: (
|
||||||
/** 弹射物实体对象 */
|
/** 弹射物实体对象 */
|
||||||
@@ -197,7 +197,7 @@ declare class Event {
|
|||||||
/** 生成流浪商人 */
|
/** 生成流浪商人 */
|
||||||
static listen(
|
static listen(
|
||||||
/** 事件名 */
|
/** 事件名 */
|
||||||
event: "SpawnWanderingTrader",
|
event: "onSpawnWanderingTrader",
|
||||||
/** 回调函数 */
|
/** 回调函数 */
|
||||||
listener: (
|
listener: (
|
||||||
/** 生成的坐标 */
|
/** 生成的坐标 */
|
||||||
@@ -208,7 +208,7 @@ declare class Event {
|
|||||||
/** 处理物品请求 */
|
/** 处理物品请求 */
|
||||||
static listen(
|
static listen(
|
||||||
/** 事件名 */
|
/** 事件名 */
|
||||||
event: "HandleRequestAction",
|
event: "onHandleRequestAction",
|
||||||
/** 回调函数 */
|
/** 回调函数 */
|
||||||
listener: (
|
listener: (
|
||||||
/** 请求玩家 */
|
/** 请求玩家 */
|
||||||
@@ -231,7 +231,7 @@ declare class Event {
|
|||||||
/** 发送容器关闭数据包后(不可拦截) */
|
/** 发送容器关闭数据包后(不可拦截) */
|
||||||
static listen(
|
static listen(
|
||||||
/** 事件名 */
|
/** 事件名 */
|
||||||
event: "SendContainerClosePacket",
|
event: "onSendContainerClosePacket",
|
||||||
/** 回调函数 */
|
/** 回调函数 */
|
||||||
listener: (
|
listener: (
|
||||||
/** 要被关闭的玩家 */
|
/** 要被关闭的玩家 */
|
||||||
|
|||||||
Vendored
+13
-1
@@ -1073,6 +1073,12 @@ interface Player {
|
|||||||
/** 物品 */
|
/** 物品 */
|
||||||
item: Item
|
item: Item
|
||||||
): void;
|
): void;
|
||||||
|
|
||||||
|
/** (GMLIB)获取玩家破坏方块所需时间 */
|
||||||
|
getDestroyProgress(
|
||||||
|
/** 方块对象 */
|
||||||
|
block: Block
|
||||||
|
): number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Entity {
|
interface Entity {
|
||||||
@@ -1123,8 +1129,14 @@ interface Entity {
|
|||||||
/** (GMLIB)获取实体的命名 */
|
/** (GMLIB)获取实体的命名 */
|
||||||
getNameTag(): string;
|
getNameTag(): string;
|
||||||
|
|
||||||
/** 获取实体的主人 */
|
/** (GMLIB)获取实体的主人 */
|
||||||
getEntityOwner(): Entity | null;
|
getEntityOwner(): Entity | null;
|
||||||
|
|
||||||
|
/** (GMLIB)实体是否包含在某类里 */
|
||||||
|
hasFamily(
|
||||||
|
/** 实体族 */
|
||||||
|
family: string
|
||||||
|
): boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Block {
|
interface Block {
|
||||||
|
|||||||
+25
-1
@@ -339,7 +339,11 @@ const GMLIB_API = {
|
|||||||
/** 玩家是否拥有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} */
|
/** 获取物品最大堆叠数量 @type {function(Item):number} */
|
||||||
getItemMaxCount: ll.import("GMLIB_API", "getItemMaxCount")
|
getItemMaxCount: ll.import("GMLIB_API", "getItemMaxCount"),
|
||||||
|
/** 实体包含在某族里 @type {function(Entity,string):boolean} */
|
||||||
|
entityHasFamily: ll.import("GMLIB_API", "entityHasFamily"),
|
||||||
|
/** 获取玩家破坏方块所需时间 @type {function(Player,Block):number} */
|
||||||
|
getPlayerDestroyBlockProgress: ll.import("GMLIB_API", "getPlayerDestroyBlockProgress")
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 静态悬浮字类列表 @type {Map<number,StaticFloatingText>} */
|
/** 静态悬浮字类列表 @type {Map<number,StaticFloatingText>} */
|
||||||
@@ -2504,6 +2508,26 @@ LLSE_Item.prototype.getMaxCount =
|
|||||||
return GMLIB_API.getItemMaxCount(this);
|
return GMLIB_API.getItemMaxCount(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LLSE_Entity.prototype.hasFamily =
|
||||||
|
/**
|
||||||
|
* 实体是否拥包含在某族里
|
||||||
|
* @param {string} family 实体族
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
function (family) {
|
||||||
|
return GMLIB_API.entityHasFamily(this, family);
|
||||||
|
}
|
||||||
|
|
||||||
|
LLSE_Player.prototype.getDestroyProgress =
|
||||||
|
/**
|
||||||
|
* 获取玩家破坏方块所需时间
|
||||||
|
* @param {Block} block
|
||||||
|
* @returns {number}
|
||||||
|
*/
|
||||||
|
function (block) {
|
||||||
|
return GMLIB_API.getPlayerDestroyBlockProgress(this, block);
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
StaticFloatingText,
|
StaticFloatingText,
|
||||||
DynamicFloatingText,
|
DynamicFloatingText,
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
|
#include "magic_enum.hpp"
|
||||||
|
#include "mc/deps/core/string/HashedString.h"
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
|
||||||
bool isInteger(const std::string& str) {
|
bool isInteger(const std::string& str) {
|
||||||
@@ -884,4 +886,10 @@ void Export_Compatibility_API() {
|
|||||||
RemoteCall::exportAs("GMLIB_API", "getItemMaxCount", [](ItemStack const* item) -> int {
|
RemoteCall::exportAs("GMLIB_API", "getItemMaxCount", [](ItemStack const* item) -> int {
|
||||||
return item->getMaxStackSize();
|
return item->getMaxStackSize();
|
||||||
});
|
});
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "entityHasFamily", [](Actor* entity, std::string const& family) -> bool {
|
||||||
|
return entity->hasFamily(HashedString(family));
|
||||||
|
});
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "getPlayerDestroyBlockProgress", [](Player* player, Block const* block) -> float {
|
||||||
|
return player->getDestroyProgress(*block);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
+6
-6
@@ -206,7 +206,7 @@ void Export_Event_API() {
|
|||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case doHash("DragonRespawn"): {
|
case doHash("onDragonRespawn"): {
|
||||||
auto Call = RemoteCall::importAs<bool(int64 enderDragonUniqueID)>(eventName, eventId);
|
auto Call = RemoteCall::importAs<bool(int64 enderDragonUniqueID)>(eventName, eventId);
|
||||||
eventBus->emplaceListener<Event::EntityEvent::DragonRespawnBeforeEvent>(
|
eventBus->emplaceListener<Event::EntityEvent::DragonRespawnBeforeEvent>(
|
||||||
[Call](Event::EntityEvent::DragonRespawnBeforeEvent& ev) {
|
[Call](Event::EntityEvent::DragonRespawnBeforeEvent& ev) {
|
||||||
@@ -221,7 +221,7 @@ void Export_Event_API() {
|
|||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case doHash("ProjectileTryCreate"): {
|
case doHash("onProjectileTryCreate"): {
|
||||||
auto Call = RemoteCall::importAs<bool(Actor * mob, int64 uniqueId)>(eventName, eventId);
|
auto Call = RemoteCall::importAs<bool(Actor * mob, int64 uniqueId)>(eventName, eventId);
|
||||||
eventBus->emplaceListener<Event::EntityEvent::ProjectileCreateBeforeEvent>(
|
eventBus->emplaceListener<Event::EntityEvent::ProjectileCreateBeforeEvent>(
|
||||||
[Call](Event::EntityEvent::ProjectileCreateBeforeEvent& ev) {
|
[Call](Event::EntityEvent::ProjectileCreateBeforeEvent& ev) {
|
||||||
@@ -237,7 +237,7 @@ void Export_Event_API() {
|
|||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case doHash("ProjectileCreate"): {
|
case doHash("onProjectileCreate"): {
|
||||||
auto Call = RemoteCall::importAs<bool(Actor * mob, int64 uniqueId)>(eventName, eventId);
|
auto Call = RemoteCall::importAs<bool(Actor * mob, int64 uniqueId)>(eventName, eventId);
|
||||||
eventBus->emplaceListener<Event::EntityEvent::ProjectileCreateAfterEvent>(
|
eventBus->emplaceListener<Event::EntityEvent::ProjectileCreateAfterEvent>(
|
||||||
[Call](Event::EntityEvent::ProjectileCreateAfterEvent& ev) {
|
[Call](Event::EntityEvent::ProjectileCreateAfterEvent& ev) {
|
||||||
@@ -249,7 +249,7 @@ void Export_Event_API() {
|
|||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case doHash("SpawnWanderingTrader"): {
|
case doHash("onSpawnWanderingTrader"): {
|
||||||
auto Call = RemoteCall::importAs<bool(std::pair<BlockPos, int> pos)>(eventName, eventId);
|
auto Call = RemoteCall::importAs<bool(std::pair<BlockPos, int> pos)>(eventName, eventId);
|
||||||
eventBus->emplaceListener<Event::EntityEvent::SpawnWanderingTraderBeforeEvent>(
|
eventBus->emplaceListener<Event::EntityEvent::SpawnWanderingTraderBeforeEvent>(
|
||||||
[Call](Event::EntityEvent::SpawnWanderingTraderBeforeEvent& ev) {
|
[Call](Event::EntityEvent::SpawnWanderingTraderBeforeEvent& ev) {
|
||||||
@@ -264,7 +264,7 @@ void Export_Event_API() {
|
|||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case doHash("HandleRequestAction"): {
|
case doHash("onHandleRequestAction"): {
|
||||||
auto Call = RemoteCall::importAs<bool(
|
auto Call = RemoteCall::importAs<bool(
|
||||||
Player * player,
|
Player * player,
|
||||||
std::string const& actionType,
|
std::string const& actionType,
|
||||||
@@ -299,7 +299,7 @@ void Export_Event_API() {
|
|||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case doHash("SendContainerClosePacket"): {
|
case doHash("onSendContainerClosePacket"): {
|
||||||
auto Call = RemoteCall::importAs<bool(Player * player, int ContainerNetId)>(eventName, eventId);
|
auto Call = RemoteCall::importAs<bool(Player * player, int ContainerNetId)>(eventName, eventId);
|
||||||
eventBus->emplaceListener<Event::PacketEvent::ContainerClosePacketSendAfterEvent>(
|
eventBus->emplaceListener<Event::PacketEvent::ContainerClosePacketSendAfterEvent>(
|
||||||
[Call](Event::PacketEvent::ContainerClosePacketSendAfterEvent& ev) {
|
[Call](Event::PacketEvent::ContainerClosePacketSendAfterEvent& ev) {
|
||||||
|
|||||||
Reference in New Issue
Block a user