declare module 'prismarine-nbt'{ export type List = { type: TagType.List, value: { type: Tags[T]['type'], value: Tags[T]['value'][] } }; export enum TagType { Byte = 'byte', Short = 'short', Int = 'int', Long = 'long', Float = 'float', Double = 'double', ByteArray = 'byteArray', String = 'string', List = 'list', Compound = 'compound', IntArray = 'intArray', LongArray = 'longArray', } export type Tags = { [TagType.Byte]: { type: TagType.Byte, value: number }; [TagType.Short]: { type: TagType.Short, value: number }; [TagType.Int]: { type: TagType.Int, value: number }; [TagType.Long]: { type: TagType.Long, value: [number, number] }; [TagType.Float]: { type: TagType.Float, value: number }; [TagType.Double]: { type: TagType.Double, value: number }; [TagType.ByteArray]: { type: TagType.ByteArray, value: number[] }; [TagType.String]: { type: TagType.String, value: string }; [TagType.List]: List [TagType.Compound]: { type: TagType.Compound, value: Record }; [TagType.IntArray]: { type: TagType.IntArray, value: number[] }; [TagType.LongArray]: { type: TagType.LongArray, value: [number, number][] }; } export type NBTFormat = 'big' | 'little' | 'littleVarint' export type NBT = Tags['compound'] & {name: string}; export type Metadata = { // The decompressed buffer buffer: Buffer // The length of bytes read from the buffer size: number } export function writeUncompressed(value: NBT, format?: NBTFormat): Buffer; export function parseUncompressed(value: Buffer, format?: NBTFormat): NBT; export function parse(data: Buffer, nbtType?: NBTFormat): Promise<{parsed: NBT, type: NBTFormat, metadata: Metadata}>; export function simplify(data: Tags[TagType]): any // ProtoDef compiled protocols export const protos: { big: any, little: any, littleVarint: any }; // Big Endian protocol export const proto: any; // Little Endian protocol export const protoLE: any; /** @deprecated */ export function writeUncompressed(value: NBT, little?: boolean): Buffer; /** @deprecated */ export function parseUncompressed(value: Buffer, little?: boolean): NBT; /** @deprecated */ export function parse(data: Buffer, little: boolean, callback: (err: Error | null, value: NBT) => any): void; /** @deprecated */ export function parse(data: Buffer, nbtType: NBTFormat, callback: (err: Error | null, value: NBT) => any): void; /** @deprecated */ export function parse(data: Buffer, callback: (err: Error | null, value: NBT) => any): void; export function bool(val: number): { type: 'short', value: number } export function short (val: number): { type: 'short', value: number } export function byte (val: number): { type: 'byte', value: number } export function string (val: T): { type: 'string', value: T } export function comp (val: T, name?: string): { type: 'compound', name?: string, value: T } export function int (val: T): { type: 'int', value: T } export function list(value: K): { type: 'list'; value: { type: T | 'end', value: K } } export function float (value: T): { type: 'float', value: T} export function double (value: T): { type: 'double', value: T} /** * @param value Takes a BigInt or an array of two 32-bit integers */ export function long (value: T): { type: 'long', value: T} // Arrays export function byteArray (value: number[]): { type: 'byteArray', value: number[]} export function shortArray (value: number[]): { type: 'shortArray', value: number[]} export function intArray (value: number[]): { type: 'intArray', value: number[]} export function longArray (value: T): { type: 'longArray', value: T} }