UNPKG

mdkjs

Version:

mdk is a framework for developing Datapacks for Minecraft. It uses the typescript language.

104 lines (103 loc) 3.63 kB
import { LiteralUnion } from "../../tools/typings"; import { ColorType } from "mdk-nbt"; import { ClickEventType } from "./ClickEvent"; import { HoverEventType } from "./HoverEvent"; interface TextFunction { (text: string): TextTokenType; } declare type Color = LiteralUnion<ColorType, string>; interface TextTokenType { readonly insertion: TextTokenType; readonly font: (font: string) => TextTokenType; readonly color: (color: Color) => TextTokenType; readonly separator: (sep: string) => TextTokenType; readonly darkRed: TextTokenType; readonly red: TextTokenType; readonly gold: TextTokenType; readonly yellow: TextTokenType; readonly darkGreen: TextTokenType; readonly green: TextTokenType; readonly aqua: TextTokenType; readonly darkAqua: TextTokenType; readonly darkBlue: TextTokenType; readonly blue: TextTokenType; readonly white: TextTokenType; readonly gray: TextTokenType; readonly darkGray: TextTokenType; readonly black: TextTokenType; readonly darkPurple: TextTokenType; readonly lightPurple: TextTokenType; readonly reset: TextTokenType; readonly underlined: TextTokenType; readonly italic: TextTokenType; readonly bold: TextTokenType; readonly strikethrough: TextTokenType; readonly obfuscated: TextTokenType; readonly clickEvent: (clickEvent: ClickEventType) => TextTokenType; readonly hoverEvent: (hoverEvent: HoverEventType) => TextTokenType; readonly text: (text: string) => TextToken; readonly selector: (selector: string) => TextToken; readonly keybind: (keybind: string) => TextToken; readonly translate: (translate: string, withArg?: string[]) => TextToken; readonly score: (objective: string | number, name?: string) => TextToken; readonly nbtBlock: (nbtPath: string, block: string, interpret?: number) => TextToken; readonly nbtEntity: (nbtPath: string, entity: string, interpret?: number) => TextToken; readonly nbtStorage: (nbtPath: string, storage: string, interpret?: number) => TextToken; } export interface TextToken { /** 内容 */ text?: string; /** 翻译标识符的字符串 */ translate?: string; /** 列表内的参数将为译文中的变量赋值 */ with?: string[]; /** 颜色 */ color?: Color; /** 字体加粗 */ bold?: boolean; /** 字体斜体 */ italic?: boolean; /** 字体下划线 */ underlined?: boolean; /** 字体删除线 */ strikethrough?: boolean; /** 字体混淆 */ obfuscated?: boolean; /** 插入 */ insertion?: boolean; /** 点击事件 */ clickEvent?: ClickEventType; /** 悬浮事件 */ hoverEvent?: HoverEventType; score?: { /** 名字 */ name: string; /** 判据 */ objective?: string; /** 数值 */ value?: number; }; /** 选择器 */ selector?: string; /** 键位标识符的字符串 */ keybind?: string; /** nbt */ nbt?: string; /** 原始JSON文本聊天组件并解析 */ interpret?: string; /** 方块实体的坐标 */ block?: string; /** 实体选择器 */ entity?: string; /** storage标签 */ storage?: string; /** 定义的字体渲染文本 */ font?: string; /** 替换在显示多个值时使用的符号 */ separator?: string; } export declare type Text = TextTokenType & TextFunction & { create: (config?: TextToken) => Text; }; export declare const Text: Text; export {};