UNPKG

@minecraft/creator-tools

Version:

Minecraft Creator Tools command line and libraries.

58 lines (56 loc) 1.57 kB
"use strict"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", { value: true }); exports.ManagedComponent = void 0; const ste_events_1 = require("ste-events"); class ManagedComponent { get onPropertyChanged() { return this._onPropertyChanged.asEvent(); } constructor(parent, id, data) { this._onPropertyChanged = new ste_events_1.EventDispatcher(); this._parent = parent; this._data = data; this.id = id; } getData() { return this._data; } getBaseValue() { return this._data; } setData(newData) { this._parent[this.id] = newData; this._data = newData; } setBaseValue(value) { this._parent[this.id] = value; this._data = value; } getProperty(id) { if (!this._data) { return undefined; } return this._data[id]; } setProperty(propertyId, value) { if (typeof this._data === "string") { if (this.id === "minecraft:geometry") { this._data = { identifier: this._data, }; } else { this._data = { value: this._data, }; } } if (this._data && typeof this._data !== "string") { this._data[propertyId] = value; } } } exports.ManagedComponent = ManagedComponent; //# sourceMappingURL=../maps/minecraft/ManagedComponent.js.map