import { NbtCompoundNode } from '../nodes/NbtCompoundNode'; import { NbtNode } from '../nodes/NbtNode'; import { nbtdoc } from '../types/nbtdoc'; import { ArgumentParserResult, LegacyValidateResult } from '../types/Parser'; import { ParsingContext } from '../types/ParsingContext'; import { StringReader } from './StringReader'; declare type CompoundSupers = { Compound: nbtdoc.Index; }; declare type RegistrySupers = { Registry: { target: string; path: nbtdoc.FieldPath[]; }; }; declare type Supers = CompoundSupers | RegistrySupers | null; declare type BooleanDoc = 'Boolean'; declare type ByteDoc = { Byte: nbtdoc.NumberTag; }; declare type ShortDoc = { Short: nbtdoc.NumberTag; }; declare type IntDoc = { Int: nbtdoc.NumberTag; }; declare type LongDoc = { Long: nbtdoc.NumberTag; }; declare type FloatDoc = { Float: nbtdoc.NumberTag; }; declare type DoubleDoc = { Double: nbtdoc.NumberTag; }; declare type StringDoc = 'String'; declare type ByteArrayDoc = { ByteArray: nbtdoc.NumberArrayTag; }; declare type IntArrayDoc = { IntArray: nbtdoc.NumberArrayTag; }; declare type LongArrayDoc = { LongArray: nbtdoc.NumberArrayTag; }; export declare type CompoundDoc = { Compound: nbtdoc.Index; }; declare type EnumDoc = { Enum: nbtdoc.Index; }; export declare type ListDoc = { List: { length_range: [number, number] | null; value_type: nbtdoc.NbtValue; }; }; export declare type IndexDoc = { Index: { target: string; path: nbtdoc.FieldPath[]; }; }; declare type IdDoc = { Id: string; }; export declare type OrDoc = { Or: nbtdoc.NbtValue[]; }; export declare class NbtdocHelper { private readonly doc; constructor(doc: nbtdoc.Root); static readonly CompiledFallbacks: { [type: string]: nbtdoc.CompoundTag | undefined; }; private readonly mockCompoundArena; private mockCompoundIndexNext; private readonly mockEnumArena; private mockEnumIndexNext; private mockCompoundDoc; readCompound(index: nbtdoc.Index | null): nbtdoc.CompoundTag | null; readEnum(index: nbtdoc.Index): nbtdoc.EnumItem; resolveRegistryCompound(type: string, id: string | null): { Compound: number; } | null; /** * Get the supers of this compound tag doc. * @param supers An index or a compound. * @param node The super tag node. */ private getSupers; private followFieldPath; readCompoundKeys(doc: nbtdoc.CompoundTag | null, node: NbtCompoundNode | null): string[]; /** * @param node The node which is at the same level as the `doc` */ readField(doc: nbtdoc.CompoundTag | null, key: string, node: NbtCompoundNode | null): nbtdoc.Field | null; completeField(ans: LegacyValidateResult, ctx: ParsingContext, doc: nbtdoc.NbtValue | null, isPredicate: boolean, description: string, start: number, end: number): void; private completeOpenCloseField; private completeByteArrayField; private completeCompoundField; private completeIntArrayField; private completeListField; private completeLongArrayField; private completeBooleanField; private static handleDescription; completeCompoundKeys(ans: LegacyValidateResult, ctx: ParsingContext, tag: NbtCompoundNode, doc: CompoundDoc | IndexDoc | null, currentType: 'always double' | 'always single' | null, start: number, end: number): void; private completeEnumField; private completeIdField; private completeStringField; validateField(ans: LegacyValidateResult, ctx: ParsingContext, tag: NbtNode, doc: nbtdoc.NbtValue | null, isPredicate: boolean, description: string): void; /** * @returns If it matches loosely; whether or not should be furthermore validated. */ private validateNbtNodeType; private validateCollectionLength; private validateNumberArrayField; private validateNumberField; /** * @param node The node which is at the same level as the `doc` */ canHaveArbitraryTags(doc: nbtdoc.CompoundTag | null, node: NbtCompoundNode | null): boolean; isAnyCompound(key: string, field: nbtdoc.Field | null): boolean; private validateCompoundDoc; private static getFormattedString; private static quoteCompletionText; private static getQuoteType; private static escapeCompletion; private static getValueType; private static localeType; private validateBooleanField; private validateByteArrayField; private validateByteField; private validateCompoundField; private validateDoubleField; private validateEnumField; private validateFloatField; private static getIdentityTypeFromRegistry; private validateIdField; private validateIndexField; private validateIntArrayField; private validateIntField; private validateListField; private validateLongArrayField; private validateLongField; private validateOrField; private validateShortField; private validateStringField; private validateInnerString; private combineResult; /** * @param tag The compound tag which encloses the tag corresponding to `doc`. */ private resolveIndexDoc; private resolveCustomIndexDoc; private getCustomBlockItemStatesIndexDoc; private getCustomBlockStatesIndexDoc; private resolveCustomSpawnItemIndexDoc; /** * @param tag The compound tag which encloses the tag corresponding to `doc`. * @returns An index of a compound doc */ resolveCompoundOrIndexDoc(doc: CompoundDoc | IndexDoc | null, tag: NbtCompoundNode | null, ctx: ParsingContext): number | null; static getCompiledFallback(root: nbtdoc.Root, type: string): nbtdoc.CompoundTag; static isRegistrySupers(supers: Supers): supers is RegistrySupers; static isBooleanDoc(doc: any): doc is BooleanDoc; static isByteDoc(doc: any): doc is ByteDoc; static isShortDoc(doc: any): doc is ShortDoc; static isIntDoc(doc: any): doc is IntDoc; static isLongDoc(doc: any): doc is LongDoc; static isFloatDoc(doc: any): doc is FloatDoc; static isDoubleDoc(doc: any): doc is DoubleDoc; static isStringDoc(doc: any): doc is StringDoc; static isByteArrayDoc(doc: any): doc is ByteArrayDoc; static isIntArrayDoc(doc: any): doc is IntArrayDoc; static isLongArrayDoc(doc: any): doc is LongArrayDoc; static isCompoundDoc(doc: any): doc is CompoundDoc; static isEnumDoc(doc: any): doc is EnumDoc; static isListDoc(doc: any): doc is ListDoc; static isIndexDoc(doc: any): doc is IndexDoc; static isIdDoc(doc: any): doc is IdDoc; static isOrDoc(doc: any): doc is OrDoc; static isCompoundOrIndexDoc(doc: any): doc is CompoundDoc | IndexDoc; static getKeyDescription(value: nbtdoc.NbtValue, description: string): string; static forEachOrDoc(ans: ArgumentParserResult, reader: StringReader, doc: OrDoc, cb: (ans: ArgumentParserResult, reader: StringReader, doc: nbtdoc.NbtValue) => any): void; } export {};