UNPKG

gmll

Version:

A generic launcher core for building custom launchers

89 lines (88 loc) 2.48 kB
/// <reference types="node" /> /** * An NBT reader implement in JS. */ import { File } from "gfsl"; export declare enum tagTypes { "TAG_End" = 0, "TAG_Byte" = 1, "TAG_Short" = 2, "TAG_Int" = 3, "TAG_Long" = 4, "TAG_Float" = 5, "TAG_Double" = 6, "TAG_Byte_Array" = 7, "TAG_String" = 8, "TAG_List" = 9, "TAG_Compound" = 10, "TAG_Int_Array" = 11, "TAG_Long_Array" = 12 } export type typedNBT = { [key: string]: { tag: tagTypes.TAG_Compound; value: typedNBT; } | { tag: tagTypes.TAG_Byte_Array; value: { tag: tagTypes.TAG_Byte; value: number[]; }; } | { tag: tagTypes.TAG_Int_Array; value: { tag: tagTypes.TAG_Int; value: number[]; }; } | { tag: tagTypes.TAG_Long_Array; value: { tag: tagTypes.TAG_Long; value: number[]; }; } | { tag: tagTypes.TAG_List; value: { tag: tagTypes.TAG_Compound; value: typedNBT[]; } | { tag: tagTypes.TAG_Byte_Array; value: { tag: tagTypes.TAG_Byte; value: number[][]; }; } | { tag: tagTypes.TAG_Int_Array; value: { tag: tagTypes.TAG_Int; value: number[][]; }; } | { tag: tagTypes.TAG_Long_Array; value: { tag: tagTypes.TAG_Long; value: number[][]; }; } | { tag: tagTypes.TAG_List; value: { tag: tagTypes; value: string[][] | number[][] | typedNBT[][]; }; } | { tag: tagTypes; value: string[] | number[]; }; } | { tag: tagTypes; value: string | number; }; }; /**Takes in NBT data and returns a json object representation of it */ export declare function readNBT<T>(raw: Buffer): T; /**Takes in NBT data and returns a node based json representation of it */ export declare function readNBT(raw: Buffer, typed: true): typedNBT; /**Reads a .DAT file and returns a json object representation of it */ export declare function readDat<T>(path: File): Promise<T>; /**Reads a .DAT file and returns a node based json representation of it */ export declare function readDat(path: File, typed: true): Promise<typedNBT>;