UNPKG

@throw-out-error/minecraft-datapack

Version:

A module for making minecraft datapacks with node to cut down on the repetition.

87 lines (86 loc) 2.94 kB
import { Tag } from "./tag"; import { Recipe } from "./recipes"; import { LootTable } from "./loot"; import { McFunction } from "@throw-out-error/minecraft-mcfunction"; export declare class Namespace { name: string; blockTags: { [key: string]: Tag; }; itemTags: { [key: string]: Tag; }; functionTags: { [key: string]: Tag; }; recipes: { [key: string]: Recipe; }; lootTables: { [key: string]: LootTable; }; functions: { [key: string]: McFunction; }; /** * Creates a namespace * @param {string} name The name of the namespace */ constructor(name: string); /** * Outputs the namespace's files * @param {string} root The root path where the namespace will compile */ compile(root: string): Promise<any[]>; /** * Add a tag to the namespace * @param {Tag} tag The tag to be added * @returns {Tag} a reference to the added tag */ addTag(tag: Tag): Tag; /** * Create a tag and add it to the namespace * @param {string} path The path of the tag file relative to namespace/tags/type (excluding the file extension) * @param {('block'|'item'|'function')} type The type of tag * @param {string[]} [values=[]] * @returns {Tag} a reference to the created tag */ createTag(path: string, type: "block" | "item" | "function", values?: string[]): Tag; /** * Delete a tag * @param {string} path The path of the tag file relative to namespace/tags/type (excluding the file extension) to be deleted * @param {('block'|'item'|'function')} type The type of tag to be deleted */ deleteTag(path: any, type: any): void; /** * Add a recipe to the namespace * @param {Recipe} recipe The recipe to be added * @returns {Recipe} a reference to the added recipe */ addRecipe(recipe: Recipe): Recipe; /** * Delete a recipe * @param {string} path The path of the recipe file relative to namespace/recipes (excluding the file extension) to be deleted */ deleteRecipe(path: any): void; /** * Add a loot table to the namespace * @param {LootTable} lootTable The loot table to be added * @returns {LootTable} a reference to the added loot table */ addLootTable(lootTable: LootTable): LootTable; /** * Create a loot table then add it to the namespace * @param {string} path the path of the loot table to be created * @returns {LootTable} a reference to the created pool */ createLootTable(path: string): LootTable; addFunction(funct: McFunction): McFunction; addFunction(source: () => void): McFunction; /** * Creates a copy of the namespace * @param {Namespace} namespace the namespace to be copied * @returns {Namespace} a copy of the namespace */ static copy(namespace: Namespace): Namespace; }