@minecraft/creator-tools
Version:
Minecraft Creator Tools command line and libraries.
45 lines (44 loc) • 1.69 kB
JavaScript
;
// 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 ChestBlockActor extends BlockActor_1.default {
findable;
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;