@throw-out-error/minecraft-mcfunction
Version:
A simple way to create your mcfunction files using Typescript syntax.
40 lines (39 loc) • 1.34 kB
TypeScript
import { Command } from './commands';
interface OptionsName {
commands: Iterable<Command>;
}
interface OptionsSource {
name?: string;
}
export declare class McFunction {
readonly commands: Set<Command>;
readonly name: string;
dependencies: Set<McFunction>;
constructor(name: string, opts?: OptionsName);
constructor(name: string, cmds?: Iterable<Command>);
constructor(source: () => void, opts?: OptionsSource);
compile(): ReturnType<McFunction['generate']>;
compile(path: string): Promise<any>;
private generate;
/**
* Add a command to the function
* @param {Command} command the command to be added
* @deprecated pass the commands as an array to the constructor instead
*/
addCommand(command: Command): void;
/**
* Copies the function
* @param {McFunction} funct the function to be copied
* @returns {McFunction} a reference to the function
* @deprecated This implementation only creates a shallow copy and copies aren't necessary anyways
*/
static copy(funct: McFunction): McFunction;
/**
* @deprecated Use the constructor instead
*/
static from(source: () => void, opts?: {
name?: string;
}): McFunction;
}
export * from './arguments';
export * from './commands';