From 87f5227f8c1024dbf4baf4ae989807b182e1a60a Mon Sep 17 00:00:00 2001 From: GeckoThePecko Date: Sat, 27 Apr 2024 00:13:44 -0400 Subject: [PATCH 1/2] feat: fix updateManifest script so it doesn't reformat the entire plugins.json --- plugins.json | 6 ++- plugins/animation_utils.js | 4 +- src/animation_utils/package-lock.json | 17 +++++++ src/animation_utils/package.json | 10 ++-- src/animation_utils/scripts/updateManifest.js | 46 +++++++++++++------ 5 files changed, 61 insertions(+), 22 deletions(-) diff --git a/plugins.json b/plugins.json index 07b15ae5..da2a7b3b 100644 --- a/plugins.json +++ b/plugins.json @@ -359,8 +359,10 @@ "author": "Eliot Lash, Gecko, McHorse, AzureDoom, Tslat", "icon": "movie_filter", "description": "Create animated blocks, items, entity, and armor using the GeckoLib library and plugin. https://github.com/bernie-g/geckolib/wiki", - "tags": ["Minecraft: Java Edition"], - "version": "3.0.7", + "tags": [ + "Minecraft: Java Edition" + ], + "version": "3.0.8", "min_version": "4.0.0", "await_loading": true, "variant": "both", diff --git a/plugins/animation_utils.js b/plugins/animation_utils.js index d779c19c..9224786f 100644 --- a/plugins/animation_utils.js +++ b/plugins/animation_utils.js @@ -417,7 +417,7 @@ const getIcon = (name) => { /*! exports provided: meta, name, geo_name, resolution, elements, outliner, textures, default */ /***/ (function(module) { -module.exports = JSON.parse("{\"meta\":{\"format_version\":\"3.2\",\"model_format\":\"animated_entity_model\",\"box_uv\":true},\"name\":\"CustomArmor\",\"geo_name\":\"CustomArmor\",\"resolution\":{\"width\":64,\"height\":64},\"elements\":[{\"name\":\"dontTouch\",\"from\":[-4,24,-4],\"to\":[4,32,4],\"autouv\":1,\"color\":0,\"export\":false,\"locked\":true,\"origin\":[0,0,0],\"uuid\":\"9675593e-b27d-b70e-e1ea-1fc29f46a294\"},{\"name\":\"dontTouch\",\"from\":[-4,12,-2],\"to\":[4,24,2],\"autouv\":1,\"color\":0,\"export\":false,\"locked\":true,\"origin\":[0,24,0],\"uuid\":\"fa43156a-2a62-948c-082f-483d525f6d1f\"},{\"name\":\"dontTouch\",\"from\":[4,12,-2],\"to\":[8,24,2],\"autouv\":1,\"color\":0,\"export\":false,\"locked\":true,\"origin\":[4,22,0],\"uuid\":\"aa51170c-8b32-fb62-71f1-58ac0b7785a8\"},{\"name\":\"dontTouch\",\"from\":[-8,12,-2],\"to\":[-4,24,2],\"autouv\":1,\"color\":0,\"export\":false,\"locked\":true,\"origin\":[4,22,0],\"uuid\":\"bf2c2539-20e3-cfcc-94c0-491734019889\"},{\"name\":\"dontTouch\",\"from\":[-4,0,-2],\"to\":[0,12,2],\"autouv\":1,\"color\":0,\"export\":false,\"locked\":true,\"origin\":[4,22,0],\"uuid\":\"17b9bae0-356a-9bba-fad9-4672e2671191\"},{\"name\":\"dontTouch\",\"from\":[0,0,-2],\"to\":[4,12,2],\"autouv\":1,\"color\":0,\"export\":false,\"locked\":true,\"origin\":[4,22,0],\"uuid\":\"7b31bac4-dc40-2b93-1204-7bbdcfe7d924\"}],\"outliner\":[{\"name\":\"bipedHead\",\"uuid\":\"d340b6fa-56aa-9c0f-3560-7a067643b77d\",\"export\":true,\"isOpen\":true,\"visibility\":true,\"autouv\":0,\"origin\":[0,24,0],\"children\":[\"9675593e-b27d-b70e-e1ea-1fc29f46a294\",{\"name\":\"armorHead\",\"uuid\":\"6ab88dea-c816-d2bb-6be9-05ed7838da97\",\"export\":true,\"isOpen\":true,\"visibility\":true,\"autouv\":0,\"origin\":[0,24,0],\"children\":[]}]},{\"name\":\"bipedBody\",\"uuid\":\"ce5b366c-fd87-41ae-9a73-e0a4d4b05f8d\",\"export\":true,\"isOpen\":true,\"visibility\":true,\"autouv\":0,\"origin\":[0,24,0],\"children\":[\"fa43156a-2a62-948c-082f-483d525f6d1f\",{\"name\":\"armorBody\",\"uuid\":\"282fcdbb-8ea9-4a13-4154-f2ed20d696c8\",\"export\":true,\"isOpen\":true,\"visibility\":true,\"autouv\":0,\"origin\":[0,24,0],\"children\":[]}]},{\"name\":\"bipedLeftArm\",\"uuid\":\"d8113cc7-7e10-0930-259e-b8e4211ce9da\",\"export\":true,\"isOpen\":true,\"visibility\":true,\"autouv\":0,\"origin\":[4,22,0],\"children\":[\"aa51170c-8b32-fb62-71f1-58ac0b7785a8\",{\"name\":\"armorLeftArm\",\"uuid\":\"c5300e23-fd2f-b56c-3552-45d6650e11c6\",\"export\":true,\"isOpen\":true,\"visibility\":true,\"autouv\":0,\"origin\":[4,22,0],\"children\":[]}]},{\"name\":\"bipedRightArm\",\"uuid\":\"3b8901e8-3420-0834-51eb-76d64ff2ae8f\",\"export\":true,\"isOpen\":true,\"visibility\":true,\"autouv\":0,\"origin\":[-4,22,0],\"children\":[\"bf2c2539-20e3-cfcc-94c0-491734019889\",{\"name\":\"armorRightArm\",\"uuid\":\"b0d41a53-f4ce-53c1-f899-5a2048c90ac2\",\"export\":true,\"isOpen\":true,\"visibility\":true,\"autouv\":0,\"origin\":[-4,22,0],\"children\":[]}]},{\"name\":\"bipedLeftLeg\",\"uuid\":\"37231be7-a8ef-22ca-7fea-40aed58003bb\",\"export\":true,\"isOpen\":true,\"visibility\":true,\"autouv\":0,\"origin\":[2,12,0],\"children\":[\"17b9bae0-356a-9bba-fad9-4672e2671191\",{\"name\":\"armorLeftLeg\",\"uuid\":\"e4b19746-2d17-1f56-befe-00718165ae50\",\"export\":true,\"isOpen\":true,\"visibility\":true,\"autouv\":0,\"origin\":[2,12,0],\"children\":[]},{\"name\":\"armorLeftBoot\",\"uuid\":\"9fe26b9a-ad66-9e6b-2fa2-4168e333b4be\",\"export\":true,\"isOpen\":true,\"visibility\":true,\"autouv\":0,\"origin\":[2,12,0],\"children\":[]}]},{\"name\":\"bipedRightLeg\",\"uuid\":\"45c031a5-b6be-e0a7-5454-b45d07f28429\",\"export\":true,\"isOpen\":true,\"visibility\":true,\"autouv\":0,\"origin\":[-2,12,0],\"children\":[\"7b31bac4-dc40-2b93-1204-7bbdcfe7d924\",{\"name\":\"armorRightLeg\",\"uuid\":\"60238f18-e74b-c863-cb45-2e2f162221bd\",\"export\":true,\"isOpen\":true,\"visibility\":true,\"autouv\":0,\"origin\":[-2,12,0],\"children\":[]},{\"name\":\"armorRightBoot\",\"uuid\":\"eb3db34b-ccfe-dae9-ac4d-4e22c3222f70\",\"export\":true,\"isOpen\":true,\"visibility\":true,\"autouv\":0,\"origin\":[-2,12,0],\"children\":[]}]}],\"textures\":[]}"); +module.exports = JSON.parse("{\"meta\":{\"format_version\":\"3.2\",\"model_format\":\"animated_entity_model\",\"box_uv\":true},\"name\":\"CustomArmor\",\"geo_name\":\"CustomArmor\",\"resolution\":{\"width\":64,\"height\":64},\"elements\":[{\"name\":\"dontTouch\",\"from\":[-4,24,-4],\"to\":[4,32,4],\"autouv\":1,\"color\":0,\"export\":false,\"locked\":true,\"origin\":[0,0,0],\"uuid\":\"9675593e-b27d-b70e-e1ea-1fc29f46a294\"},{\"name\":\"dontTouch\",\"from\":[-4,12,-2],\"to\":[4,24,2],\"autouv\":1,\"color\":0,\"export\":false,\"locked\":true,\"origin\":[0,24,0],\"uuid\":\"fa43156a-2a62-948c-082f-483d525f6d1f\"},{\"name\":\"dontTouch\",\"from\":[4,12,-2],\"to\":[8,24,2],\"autouv\":1,\"color\":0,\"export\":false,\"locked\":true,\"origin\":[4,22,0],\"uuid\":\"aa51170c-8b32-fb62-71f1-58ac0b7785a8\"},{\"name\":\"dontTouch\",\"from\":[-8,12,-2],\"to\":[-4,24,2],\"autouv\":1,\"color\":0,\"export\":false,\"locked\":true,\"origin\":[4,22,0],\"uuid\":\"bf2c2539-20e3-cfcc-94c0-491734019889\"},{\"name\":\"dontTouch\",\"from\":[-4,0,-2],\"to\":[0,12,2],\"autouv\":1,\"color\":0,\"export\":false,\"locked\":true,\"origin\":[4,22,0],\"uuid\":\"17b9bae0-356a-9bba-fad9-4672e2671191\"},{\"name\":\"dontTouch\",\"from\":[0,0,-2],\"to\":[4,12,2],\"autouv\":1,\"color\":0,\"export\":false,\"locked\":true,\"origin\":[4,22,0],\"uuid\":\"7b31bac4-dc40-2b93-1204-7bbdcfe7d924\"}],\"outliner\":[{\"name\":\"bipedHead\",\"uuid\":\"d340b6fa-56aa-9c0f-3560-7a067643b77d\",\"export\":true,\"isOpen\":true,\"visibility\":true,\"autouv\":0,\"origin\":[0,24,0],\"children\":[\"9675593e-b27d-b70e-e1ea-1fc29f46a294\",{\"name\":\"armorHead\",\"uuid\":\"6ab88dea-c816-d2bb-6be9-05ed7838da97\",\"export\":true,\"isOpen\":true,\"visibility\":true,\"autouv\":0,\"origin\":[0,24,0],\"children\":[]}]},{\"name\":\"bipedBody\",\"uuid\":\"ce5b366c-fd87-41ae-9a73-e0a4d4b05f8d\",\"export\":true,\"isOpen\":true,\"visibility\":true,\"autouv\":0,\"origin\":[0,24,0],\"children\":[\"fa43156a-2a62-948c-082f-483d525f6d1f\",{\"name\":\"armorBody\",\"uuid\":\"282fcdbb-8ea9-4a13-4154-f2ed20d696c8\",\"export\":true,\"isOpen\":true,\"visibility\":true,\"autouv\":0,\"origin\":[0,24,0],\"children\":[]}]},{\"name\":\"bipedRightArm\",\"uuid\":\"d8113cc7-7e10-0930-259e-b8e4211ce9da\",\"export\":true,\"isOpen\":true,\"visibility\":true,\"autouv\":0,\"origin\":[4,22,0],\"children\":[\"aa51170c-8b32-fb62-71f1-58ac0b7785a8\",{\"name\":\"armorRightArm\",\"uuid\":\"c5300e23-fd2f-b56c-3552-45d6650e11c6\",\"export\":true,\"isOpen\":true,\"visibility\":true,\"autouv\":0,\"origin\":[4,22,0],\"children\":[]}]},{\"name\":\"bipedLeftArm\",\"uuid\":\"3b8901e8-3420-0834-51eb-76d64ff2ae8f\",\"export\":true,\"isOpen\":true,\"visibility\":true,\"autouv\":0,\"origin\":[-4,22,0],\"children\":[\"bf2c2539-20e3-cfcc-94c0-491734019889\",{\"name\":\"armorLeftArm\",\"uuid\":\"b0d41a53-f4ce-53c1-f899-5a2048c90ac2\",\"export\":true,\"isOpen\":true,\"visibility\":true,\"autouv\":0,\"origin\":[-4,22,0],\"children\":[]}]},{\"name\":\"bipedLeftLeg\",\"uuid\":\"37231be7-a8ef-22ca-7fea-40aed58003bb\",\"export\":true,\"isOpen\":true,\"visibility\":true,\"autouv\":0,\"origin\":[2,12,0],\"children\":[\"17b9bae0-356a-9bba-fad9-4672e2671191\",{\"name\":\"armorLeftLeg\",\"uuid\":\"e4b19746-2d17-1f56-befe-00718165ae50\",\"export\":true,\"isOpen\":true,\"visibility\":true,\"autouv\":0,\"origin\":[2,12,0],\"children\":[]},{\"name\":\"armorLeftBoot\",\"uuid\":\"9fe26b9a-ad66-9e6b-2fa2-4168e333b4be\",\"export\":true,\"isOpen\":true,\"visibility\":true,\"autouv\":0,\"origin\":[2,12,0],\"children\":[]}]},{\"name\":\"bipedRightLeg\",\"uuid\":\"45c031a5-b6be-e0a7-5454-b45d07f28429\",\"export\":true,\"isOpen\":true,\"visibility\":true,\"autouv\":0,\"origin\":[-2,12,0],\"children\":[\"7b31bac4-dc40-2b93-1204-7bbdcfe7d924\",{\"name\":\"armorRightLeg\",\"uuid\":\"60238f18-e74b-c863-cb45-2e2f162221bd\",\"export\":true,\"isOpen\":true,\"visibility\":true,\"autouv\":0,\"origin\":[-2,12,0],\"children\":[]},{\"name\":\"armorRightBoot\",\"uuid\":\"eb3db34b-ccfe-dae9-ac4d-4e22c3222f70\",\"export\":true,\"isOpen\":true,\"visibility\":true,\"autouv\":0,\"origin\":[-2,12,0],\"children\":[]}]}],\"textures\":[]}"); /***/ }), @@ -8305,7 +8305,7 @@ module.exports = function(module) { /*! exports provided: name, version, private, description, main, scripts, author, license, blockbenchConfig, sideEffects, devDependencies, dependencies, default */ /***/ (function(module) { -module.exports = JSON.parse("{\"name\":\"animation_utils\",\"version\":\"3.0.7\",\"private\":true,\"description\":\"GeckoLib Animation Utils\",\"main\":\"index.js\",\"scripts\":{\"build\":\"webpack && node scripts/updateManifest.js\",\"start\":\"webpack --watch --mode=development\",\"lint\":\"eslint .\",\"lint:fix\":\"eslint --fix .\",\"pretest\":\"npm run lint\",\"test\":\"echo \\\"Error: no test specified\\\" && exit 1\"},\"author\":\"Eliot Lash, Gecko, McHorse, AzureDoom\",\"license\":\"MIT\",\"blockbenchConfig\":{\"title\":\"GeckoLib Animation Utils\",\"author\":\"Eliot Lash, Gecko, McHorse, AzureDoom, Tslat\",\"icon\":\"movie_filter\",\"description\":\"Create animated blocks, items, entity, and armor using the GeckoLib library and plugin. https://github.com/bernie-g/geckolib/wiki\",\"min_version\":\"4.0.0\",\"max_version\":\"5.0.0\",\"variant\":\"both\"},\"sideEffects\":[\"./index.js\"],\"devDependencies\":{\"eol\":\"0.9.1\",\"eslint\":\"7.7.0\",\"webpack\":\"4.43.0\",\"webpack-cli\":\"3.3.12\"},\"dependencies\":{\"lodash\":\"^4.17.21\",\"semver\":\"7.3.2\"}}"); +module.exports = JSON.parse("{\"name\":\"animation_utils\",\"version\":\"3.0.8\",\"private\":true,\"description\":\"GeckoLib Animation Utils\",\"main\":\"index.js\",\"scripts\":{\"build\":\"webpack && npm run update_manifest\",\"update_manifest\":\"node scripts/updateManifest.js\",\"start\":\"webpack --watch --mode=development\",\"lint\":\"eslint .\",\"lint:fix\":\"eslint --fix .\",\"pretest\":\"npm run lint\",\"test\":\"echo \\\"Error: no test specified\\\" && exit 1\"},\"author\":\"Eliot Lash, Gecko, McHorse, AzureDoom, Tslat\",\"license\":\"MIT\",\"blockbenchConfig\":{\"title\":\"GeckoLib Animation Utils\",\"author\":\"Eliot Lash, Gecko, McHorse, AzureDoom, Tslat\",\"icon\":\"movie_filter\",\"description\":\"Create animated blocks, items, entity, and armor using the GeckoLib library and plugin. https://github.com/bernie-g/geckolib/wiki\",\"min_version\":\"4.0.0\",\"max_version\":\"5.0.0\",\"variant\":\"both\"},\"sideEffects\":[\"./index.js\"],\"devDependencies\":{\"eol\":\"0.9.1\",\"eslint\":\"7.7.0\",\"webpack\":\"4.43.0\",\"webpack-cli\":\"3.3.12\",\"indent-string\":\"^5.0.0\"},\"dependencies\":{\"lodash\":\"^4.17.21\",\"semver\":\"7.3.2\"}}"); /***/ }), diff --git a/src/animation_utils/package-lock.json b/src/animation_utils/package-lock.json index a93b2276..2be0e9da 100644 --- a/src/animation_utils/package-lock.json +++ b/src/animation_utils/package-lock.json @@ -9,6 +9,7 @@ "version": "3.0.7", "license": "MIT", "dependencies": { + "indent-string": "^5.0.0", "lodash": "^4.17.21", "semver": "7.3.2" }, @@ -2562,6 +2563,17 @@ "node": ">=0.8.19" } }, + "node_modules/indent-string": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", + "integrity": "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/infer-owner": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz", @@ -7200,6 +7212,11 @@ "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "dev": true }, + "indent-string": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", + "integrity": "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==" + }, "infer-owner": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz", diff --git a/src/animation_utils/package.json b/src/animation_utils/package.json index 7932b26f..045b905b 100644 --- a/src/animation_utils/package.json +++ b/src/animation_utils/package.json @@ -1,18 +1,19 @@ { "name": "animation_utils", - "version": "3.0.7", + "version": "3.0.8", "private": true, "description": "GeckoLib Animation Utils", "main": "index.js", "scripts": { - "build": "webpack && node scripts/updateManifest.js", + "build": "webpack && npm run update_manifest", + "update_manifest": "node scripts/updateManifest.js", "start": "webpack --watch --mode=development", "lint": "eslint .", "lint:fix": "eslint --fix .", "pretest": "npm run lint", "test": "echo \"Error: no test specified\" && exit 1" }, - "author": "Eliot Lash, Gecko, McHorse, AzureDoom", + "author": "Eliot Lash, Gecko, McHorse, AzureDoom, Tslat", "license": "MIT", "blockbenchConfig": { "title": "GeckoLib Animation Utils", @@ -30,7 +31,8 @@ "eol": "0.9.1", "eslint": "7.7.0", "webpack": "4.43.0", - "webpack-cli": "3.3.12" + "webpack-cli": "3.3.12", + "indent-string": "^5.0.0" }, "dependencies": { "lodash": "^4.17.21", diff --git a/src/animation_utils/scripts/updateManifest.js b/src/animation_utils/scripts/updateManifest.js index 791f6d32..e9d8a5e1 100644 --- a/src/animation_utils/scripts/updateManifest.js +++ b/src/animation_utils/scripts/updateManifest.js @@ -1,19 +1,37 @@ -const fs = require('fs'); -const eol = require('eol'); -const { version, blockbenchConfig } = require('../package.json'); -const PACKAGE_MANIFEST_PATH = '../../plugins.json'; -const manifest = require(`../${PACKAGE_MANIFEST_PATH}`); +(async () => { + const indentString = (await import('indent-string')).default; + const path = require('path'); + const fs = require('fs'); + const eol = require('eol'); + const url = require('url'); + // @ts-ignore -// console.log({ version, blockbenchConfig }); + const PACKAGE_JSON_PATH = './package.json' + const PLUGINS_MANIFEST_PATH = '../../plugins.json' -Object.assign( - manifest.animation_utils, - { version }, - blockbenchConfig, -); + const pluginsString = fs.readFileSync(PLUGINS_MANIFEST_PATH, { encoding: 'utf8' }); + const pluginsObj = JSON.parse(pluginsString); -fs.writeFileSync(PACKAGE_MANIFEST_PATH, eol.crlf(JSON.stringify(manifest, null, '\t'))); + const packageJsonString = fs.readFileSync(PACKAGE_JSON_PATH, { encoding: 'utf8' }); + const { version, blockbenchConfig } = JSON.parse(packageJsonString); -// console.log('manifest', manifest); + // console.log({ version, blockbenchConfig }); -// console.log(`Wrote manifest to ${PACKAGE_MANIFEST_PATH}.`); \ No newline at end of file + const newAnimationUtilsManifest = Object.assign( + {}, + pluginsObj.animation_utils, + { version }, + blockbenchConfig, + ); + const newAnimationUtilsManifestString = + indentString( + JSON.stringify(newAnimationUtilsManifest, null, '\t'), + 1, + { indent: '\t' } + ) + .trimStart(); + + const newPluginsString = pluginsString.replace(/("animation_utils":\s*)({[\s\S.]*?})/, `$1${newAnimationUtilsManifestString}`); + + fs.writeFileSync(PLUGINS_MANIFEST_PATH, eol.lf(newPluginsString)); +})(); \ No newline at end of file From 0d01b8c1abdea47d99add63ede9965e995675a64 Mon Sep 17 00:00:00 2001 From: GeckoThePecko Date: Sat, 27 Apr 2024 00:14:29 -0400 Subject: [PATCH 2/2] fix: flip the armor template arms once and for all --- src/animation_utils/armorTemplate.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/animation_utils/armorTemplate.json b/src/animation_utils/armorTemplate.json index 9cca0c70..30807a5d 100644 --- a/src/animation_utils/armorTemplate.json +++ b/src/animation_utils/armorTemplate.json @@ -216,7 +216,7 @@ ] }, { - "name": "bipedLeftArm", + "name": "bipedRightArm", "uuid": "d8113cc7-7e10-0930-259e-b8e4211ce9da", "export": true, "isOpen": true, @@ -230,7 +230,7 @@ "children": [ "aa51170c-8b32-fb62-71f1-58ac0b7785a8", { - "name": "armorLeftArm", + "name": "armorRightArm", "uuid": "c5300e23-fd2f-b56c-3552-45d6650e11c6", "export": true, "isOpen": true, @@ -248,7 +248,7 @@ ] }, { - "name": "bipedRightArm", + "name": "bipedLeftArm", "uuid": "3b8901e8-3420-0834-51eb-76d64ff2ae8f", "export": true, "isOpen": true, @@ -262,7 +262,7 @@ "children": [ "bf2c2539-20e3-cfcc-94c0-491734019889", { - "name": "armorRightArm", + "name": "armorLeftArm", "uuid": "b0d41a53-f4ce-53c1-f899-5a2048c90ac2", "export": true, "isOpen": true,