"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Database_1 = require("./Database");
const ItemTextureCatalogDefinition_1 = require("./ItemTextureCatalogDefinition");
const SoundDefinitionCatalogDefinition_1 = require("./SoundDefinitionCatalogDefinition");
const BlocksCatalogDefinition_1 = require("./BlocksCatalogDefinition");
const TerrainTextureCatalogDefinition_1 = require("./TerrainTextureCatalogDefinition");
class VanillaProjectManager {
    static blocksCatalog = null;
    static itemTextureCatalog = null;
    static terrainTextureCatalog = null;
    static soundDefinitionCatalog = null;
    static getBlocksCatalogDirect() {
        return this.blocksCatalog;
    }
    static async getBlocksCatalog() {
        if (!VanillaProjectManager.blocksCatalog) {
            const file = await Database_1.default.getPreviewVanillaFile("/resource_pack/blocks.json");
            if (file) {
                const blockCat = new BlocksCatalogDefinition_1.default();
                blockCat.file = file;
                await blockCat.load();
                this.blocksCatalog = blockCat;
            }
        }
        return this.blocksCatalog;
    }
    static getTerrainTexturesCatalogDirect() {
        return this.terrainTextureCatalog;
    }
    static async getTerrainTexturesCatalog() {
        if (!VanillaProjectManager.terrainTextureCatalog) {
            const file = await Database_1.default.getPreviewVanillaFile("/resource_pack/textures/terrain_texture.json");
            if (file) {
                const terrainCat = new TerrainTextureCatalogDefinition_1.default();
                terrainCat.file = file;
                await terrainCat.load();
                VanillaProjectManager.terrainTextureCatalog = terrainCat;
            }
        }
        return VanillaProjectManager.terrainTextureCatalog;
    }
    static async getItemTexturesCatalog() {
        if (!VanillaProjectManager.itemTextureCatalog) {
            const file = await Database_1.default.getPreviewVanillaFile("/resource_pack/textures/item_texture.json");
            if (file) {
                const itemCat = new ItemTextureCatalogDefinition_1.default();
                itemCat.file = file;
                await itemCat.load();
                VanillaProjectManager.itemTextureCatalog = itemCat;
            }
        }
        return VanillaProjectManager.itemTextureCatalog;
    }
    static async getSoundDefinitionCatalog() {
        if (!VanillaProjectManager.soundDefinitionCatalog) {
            const file = await Database_1.default.getPreviewVanillaFile("/resource_pack/sounds/sound_definitions.json");
            if (file) {
                const soundDefinitionCat = new SoundDefinitionCatalogDefinition_1.default();
                soundDefinitionCat.file = file;
                await soundDefinitionCat.load();
                VanillaProjectManager.soundDefinitionCatalog = soundDefinitionCat;
            }
        }
        return VanillaProjectManager.soundDefinitionCatalog;
    }
}
exports.default = VanillaProjectManager;

//# sourceMappingURL=../maps/minecraft/VanillaProjectManager.js.map
