UNPKG

@minecraft/creator-tools

Version:

Minecraft Creator Tools command line and libraries.

50 lines (49 loc) 1.83 kB
"use strict"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const BlockActor_1 = __importDefault(require("./BlockActor")); class CauldronBlockActor extends BlockActor_1.default { potionId; potionType; items = []; load() { if (!this.rootTag) { return; } let tag = this.rootTag.find("PotionId"); if (tag) { this.potionId = tag.valueAsInt; } tag = this.rootTag.find("PotionType"); if (tag) { this.potionType = tag.valueAsInt; } tag = this.rootTag.find("Items"); if (tag !== null) { const children = tag.getTagChildren(); this.items = []; for (let i = 0; i < children.length; i++) { const childTag = children[i]; const countTag = childTag.find("Count"); const damageTag = childTag.find("Damage"); const nameTag = childTag.find("Name"); const slotTag = childTag.find("Slot"); const wasPickedUpTag = childTag.find("WasPickedUp"); if (countTag && damageTag && nameTag && slotTag && wasPickedUpTag) { this.items.push({ count: countTag.valueAsInt, damage: damageTag.valueAsInt, name: nameTag.valueAsString, slot: slotTag.valueAsInt, wasPickedUp: wasPickedUpTag.valueAsBoolean, }); } } } } } exports.default = CauldronBlockActor;