UNPKG

@throw-out-error/minecraft-mcfunction

Version:

A simple way to create your mcfunction files using Typescript syntax.

38 lines 1.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.clear = exports.ClearCommand = void 0; const __1 = require(".."); class ClearCommand extends __1.Command { constructor(target, item, maxCount = Infinity) { super('clear'); if (maxCount < 0) throw TypeError("maxCount can't be negative"); this.target = target; this.item = item; this.maxCount = maxCount; } get [__1.Command.ARGUMENTS]() { const args = []; if (!this.target) { return args; } args.push(this.target); if (!this.item) { return args; } this.item.includeNBT = false; // TODO: Needs to be verified args.push(this.item); if (this.maxCount === Infinity) { return args; } args.push(this.maxCount); return args; } } exports.ClearCommand = ClearCommand; function clear(target, item, maxCount = Infinity) { return new ClearCommand(target, item, maxCount); } exports.clear = clear; __1.Command.registerCommand('clear', clear); //# sourceMappingURL=clear.js.map