"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", { value: true });
const BlockActor_1 = require("./BlockActor");
class ChestBlockActor extends BlockActor_1.default {
    constructor() {
        super(...arguments);
        this.items = [];
    }
    load() {
        if (!this.rootTag) {
            return;
        }
        let tag = this.rootTag.find("Findable");
        if (tag) {
            this.findable = tag.valueAsBoolean;
        }
        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 = ChestBlockActor;

//# sourceMappingURL=../../maps/minecraft/blockActors/ChestBlockActor.js.map
