UNPKG

yoni-mcscripts-lib

Version:

为 Minecraft Script API 中的部分接口创建了 wrapper,并提供简单的事件管理器和任务管理器,另附有一些便于代码编写的一些小工具。

60 lines (59 loc) 2.29 kB
import { Minecraft } from "../basis.js"; import { Scoreboard } from "../scoreboard/Scoreboard.js"; import { Dimension } from "./dimension.js"; import type { YoniEntity, YoniPlayer } from "./entity/index.js"; /** * 代表由一系列维度与其环境组成的世界。 */ declare class World { static isWorld(object: any): boolean; readonly vanillaWorld: Minecraft.World; constructor(vanillaWorld: Minecraft.World); get scoreboard(): typeof Scoreboard; /** * @deprecated 自从返回结果改为数组之后,这方法就没有意义了。 * 查找游戏中符合特定条件的玩家。 * @param {Minecraft.EntityQueryOptions} options * @yields {YoniPlayer} */ selectPlayers(options: Minecraft.EntityQueryOptions): Generator<YoniPlayer>; /** * 获取游戏中符合特定条件的玩家。 * @param {Minecraft.EntityQueryOptions} [option] * @yields {YoniPlayer} */ getPlayers(option?: Minecraft.EntityQueryOptions): Array<YoniPlayer>; /** * 获取与 `dimid` 对应的维度对象。 * @param {string|number} dimid * @returns {Dimension} */ getDimension(dimid: string | number): Dimension; /** * 获取一个游戏中的所有玩家的对象。 * @returns {YoniPlayer[]} 一个包含了游戏中所有玩家的对象的数组。 */ getAllPlayers(): YoniPlayer[]; /** * 获取一个包含了当前世界中已经加载的所有实体的对象的数组。 */ getLoadedEntities(): YoniEntity[]; /** * @deprecated 自从返回结果改为数组之后,这方法就没有意义了。 * 查找游戏中符合特定条件的实体。 * @param {Minecraft.EntityQueryOptions} options * @yields {YoniEntity} */ selectEntities(option: Minecraft.EntityQueryOptions): Generator<YoniEntity>; /** * 获取所有生物实体。 */ getLivingEntities(): YoniEntity[]; } type RemovedKeys = never; type OverridedKeys = "getDimension" | "getAllPlayers" | "scoreboard" | "getPlayers" | "getEntities"; type BaseVanillaWorldClass = Omit<Minecraft.World, RemovedKeys | OverridedKeys>; interface World extends BaseVanillaWorldClass { } export { World, World as YoniWorld }; export declare const world: World;