nbtrock
Version:
Read And Write Bedrock NBT
187 lines (137 loc) • 4.07 kB
TypeScript
/* tslint:disable */
/* eslint-disable */
/**
*/
export function init(): void;
interface IByte {
readonly Byte: number;
}
interface IShort {
readonly Short: number;
}
interface IInt {
readonly Int: number;
}
interface ILong {
readonly Long: bigint;
}
interface IFloat {
readonly Float: number;
}
interface IDouble {
readonly Double: bigint;
}
interface IString {
readonly String: string;
}
interface IByteArray {
readonly ByteArray: number[];
}
interface IIntArray {
readonly IntArray: number[];
}
interface ILongArray {
readonly LongArray: bigint[];
}
interface IList {
readonly List: IValue[];
}
interface ICompound {
readonly Compound: Map<string, IValue>;
}
type IValue = IByte | IShort | IInt | ILong | IFloat | IDouble | IString | IByteArray | IIntArray | ILongArray | IList | ICompound;
type IHeader = [number, number, number, number, number, number, number, number] | undefined;
interface INBT {
readonly name: string;
readonly data: ICompound;
}
/**
*对于[`crate::NBT`]的包装,实现了一些方法用于与JavaScript通信
*/
export class NBT {
free(): void;
/**
*从字节流中读取数据返回[`NBT`]
* @param {Uint8Array} bytes
* @returns {NBT}
*/
static from(bytes: Uint8Array): NBT;
/**
* @param {string} name
* @returns {NBT}
*/
static named(name: string): NBT;
/**
* @param {INBT} v
*/
constructor(v: INBT);
/**
*按照 ```path``` 路径设置 ```value``` 值
* @param {string} path
* @param {IValue | undefined} [value]
*/
set(path: string, value?: IValue): void;
/**
*返回生成的字节流
* @param {boolean} bedrock_header
* @returns {Uint8Array}
*/
bytes(bedrock_header: boolean): Uint8Array;
/**
*js -> toString() 调用[`Self::fmt`]方法
* @returns {string}
*/
toString(): string;
/**
* 获取内部的[`crate::NBT`]的```bedrock_header```
*/
readonly header: Uint8Array | undefined;
/**
* 设置内部的[`crate::NBT`]的```name```字段
*/
set_name: string;
/**
*返回内部的[`crate::NBT`]值
*/
readonly value: INBT;
}
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
export interface InitOutput {
readonly memory: WebAssembly.Memory;
readonly init: () => void;
readonly __wbg_nbt_free: (a: number) => void;
readonly nbt_from: (a: number, b: number, c: number) => void;
readonly nbt_named: (a: number, b: number, c: number) => void;
readonly nbt_new: (a: number, b: number) => void;
readonly nbt_value: (a: number, b: number) => void;
readonly nbt_set: (a: number, b: number, c: number, d: number, e: number) => void;
readonly nbt_bytes: (a: number, b: number, c: number) => void;
readonly nbt_set_set_name: (a: number, b: number, c: number) => void;
readonly nbt_header: (a: number, b: number) => void;
readonly nbt_toString: (a: number, b: number) => void;
readonly __wbindgen_malloc: (a: number, b: number) => number;
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
readonly __wbindgen_exn_store: (a: number) => void;
readonly __wbindgen_start: () => void;
}
export type SyncInitInput = BufferSource | WebAssembly.Module;
/**
* Instantiates the given `module`, which can either be bytes or
* a precompiled `WebAssembly.Module`.
*
* @param {SyncInitInput} module
*
* @returns {InitOutput}
*/
export function initSync(module: SyncInitInput): InitOutput;
/**
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
* for everything else, calls `WebAssembly.instantiate` directly.
*
* @param {InitInput | Promise<InitInput>} module_or_path
*
* @returns {Promise<InitOutput>}
*/
export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;