yoni-mcscripts-lib
Version:
为 Minecraft Script API 中的部分接口创建了 wrapper,并提供简单的事件管理器和任务管理器,另附有一些便于代码编写的一些小工具。
19 lines (16 loc) • 561 B
text/typescript
import { Event } from "../index.js";
import { Minecraft } from "../../basis.js";
import { EntityUtils } from "../../EntityUtils.js";
import type { YoniPlayer } from "../../types";
const EntityTypes = Minecraft.EntityTypes;
export abstract class PlayerEvent extends Event {
constructor(player: YoniPlayer | Minecraft.Player){
super();
this.#player = EntityUtils.from(player) as unknown as YoniPlayer;
}
#player: YoniPlayer;
get player(){
return this.#player;
}
eventType = EntityTypes.get("minecraft:player");
}