mc-anvil
Version:
A Typescript library for reading Minecraft Anvil format files and Minecraft NBT format files in the browser.
37 lines (36 loc) • 1.24 kB
TypeScript
import { TagData } from "./types";
export declare enum NBTActions {
NBT_DELETE_TAG = "NBT_DELETE_TAG",
NBT_ADD_TAG = "NBT_ADD_TAG",
NBT_EDIT_TAG = "NBT_EDIT_TAG",
NBT_ADD_COMPOUND_LIST_ITEM = "NBT_ADD_COMPOUND_LIST_ITEM"
}
export declare type NBTDeleteTagAction = {
type: NBTActions.NBT_DELETE_TAG;
path: string;
recursive?: boolean;
};
export declare type NBTAddTagAction = {
type: NBTActions.NBT_ADD_TAG;
path: string;
tag: TagData;
overwrite?: boolean;
recursive?: boolean;
};
export declare type NBTEditTagAction = {
type: NBTActions.NBT_EDIT_TAG;
path: string;
tag: TagData;
};
export declare type NBTAddCompoundListItemAction = {
type: NBTActions.NBT_ADD_COMPOUND_LIST_ITEM;
path: string;
index: number;
tags: TagData[];
recursive?: boolean;
overwrite?: boolean;
};
export declare type NBTAction = NBTDeleteTagAction | NBTAddTagAction | NBTEditTagAction | NBTAddCompoundListItemAction;
export declare function transformTag(tag: TagData, path: string, transform: (tag: TagData) => TagData): TagData;
export declare function deleteChild(tag: TagData, name: string): TagData;
export declare function nbtTagReducer(tag: TagData, action: NBTAction): TagData;