@throw-out-error/minecraft-mcfunction
Version:
A simple way to create your mcfunction files using Typescript syntax.
29 lines • 922 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.give = exports.GiveCommand = void 0;
const __1 = require("..");
class GiveCommand extends __1.Command {
constructor(target, item, count = 1) {
if (count < 1 || count > 64) {
throw TypeError('Count has to be in range 1 to 64');
}
super('give');
this.target = target;
this.item = item;
this.count = count;
}
get [__1.Command.ARGUMENTS]() {
this.item.includeNBT = true;
const args = [this.target, this.item];
if (this.count > 1)
args.push(this.count);
return args;
}
}
exports.GiveCommand = GiveCommand;
function give(target, item, count = 1) {
return new GiveCommand(target, item, count);
}
exports.give = give;
__1.Command.registerCommand('give', give);
//# sourceMappingURL=give.js.map