From 55d6ffef6854f740953dd9d13831e81eb282d825 Mon Sep 17 00:00:00 2001 From: Ewan Howell <48070995+ewanhowell5195@users.noreply.github.com> Date: Tue, 3 Sep 2024 18:29:54 +0100 Subject: [PATCH] batch exporter bug fixes --- plugins.json | 2 +- plugins/resource_pack_utilities/changelog.json | 14 ++++++++++++++ .../resource_pack_utilities.js | 12 +++++------- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/plugins.json b/plugins.json index 8973efb8..d1b1992b 100644 --- a/plugins.json +++ b/plugins.json @@ -365,7 +365,7 @@ "author": "Ewan Howell", "description": "A collection of utilities to assist with resource pack creation.", "tags": ["Minecraft: Java Edition", "Resource Packs", "Utilities"], - "version": "1.5.0", + "version": "1.5.1", "min_version": "4.10.0", "variant": "desktop", "website": "https://ewanhowell.com/plugins/resource-pack-utilities/", diff --git a/plugins/resource_pack_utilities/changelog.json b/plugins/resource_pack_utilities/changelog.json index 2eeae7b4..3aec4941 100644 --- a/plugins/resource_pack_utilities/changelog.json +++ b/plugins/resource_pack_utilities/changelog.json @@ -117,5 +117,19 @@ ] } ] + }, + "1.5.1": { + "title": "1.5.1", + "date": "2024-09-03", + "author": "Ewan Howell", + "categories": [ + { + "title": "Bug Fixes", + "list": [ + "Fixed Batch Exporter failing to parse certain bbmodel files", + "Fixed Batch Exporter failing to export formats where the codec ID did not match the format ID" + ] + } + ] } } \ No newline at end of file diff --git a/plugins/resource_pack_utilities/resource_pack_utilities.js b/plugins/resource_pack_utilities/resource_pack_utilities.js index 19aed0bc..aa7fd29e 100644 --- a/plugins/resource_pack_utilities/resource_pack_utilities.js +++ b/plugins/resource_pack_utilities/resource_pack_utilities.js @@ -29,7 +29,7 @@ author: "Ewan Howell", description, tags: ["Minecraft: Java Edition", "Resource Packs", "Utilities"], - version: "1.5.0", + version: "1.5.1", min_version: "4.10.0", variant: "desktop", website: `https://ewanhowell.com/plugins/${id.replace(/_/g, "-")}/`, @@ -3298,11 +3298,11 @@ } let exportOptions = {} - if (Object.keys(Codecs[this.format].export_options).length) { + if (Object.keys(Formats[this.format].codec.export_options).length) { output.log("Getting export options…") newProject("") await Codecs[this.format].promptExportOptions() - exportOptions = Codecs[this.format].getExportOptions() + exportOptions = Formats[this.format].codec.getExportOptions() await Project.close() output.log("Export options loaded") } @@ -3321,10 +3321,8 @@ this.done++ continue } - let data - try { - data = JSON.parse(await fs.promises.readFile(path.join(this.inputFolder, file))) - } catch { + const data = autoParseJSON(await fs.promises.readFile(path.join(this.inputFolder, file), "utf-8"), false) + if (!data) { output.error(`Skipping \`${file}\` as it could not be read`) this.done++ continue