Merge remote-tracking branch 'origin/master'

This commit is contained in:
Illumes 2023-10-28 11:14:45 -04:00
commit 8422b07359
3 changed files with 40 additions and 6 deletions

View File

@ -1,12 +1,19 @@
const decompress = require('decompress'); const decompress = require('decompress');
const fs = require('fs'); const fs = require('fs');
const jsonfile = require('jsonfile')
const file = 'blocks.json'
let blocks;
jsonfile.readFile(file, function (err, obj) {
if (err) console.error(err)
// console.dir(obj)
blocks = obj;
})
extract("1.8") extract("1.8")
// extract("1.20.1") // extract("1.20.1")
function extract(string) { function extract(string) {
decompress(`test/${string}.zip`, `out/${string}`).then(files => { decompress(`test/${string}.zip`, `out/${string}`).then(files => {
console.log("extracted")
// try { // try {
// fs.renameSync(`out/${string}/assets/minecraft/textures/blocks`, `out/${string}/assets/minecraft/textures/block`) // fs.renameSync(`out/${string}/assets/minecraft/textures/blocks`, `out/${string}/assets/minecraft/textures/block`)
// fs.renameSync(`out/${string}/assets/minecraft/textures/items`, `out/${string}/assets/minecraft/textures/item`) // fs.renameSync(`out/${string}/assets/minecraft/textures/items`, `out/${string}/assets/minecraft/textures/item`)
@ -14,8 +21,13 @@ function extract(string) {
// console.log(error); // console.log(error);
// } // }
files.forEach(element => { files.forEach(element => {
// console.log(`Extracted ${element.path} from ${string}.zip`) if (!element.path.includes("assets/minecraft/textures/")) {
console.log(files) return;
}
let texture = element.path.match(/(?:[A-Za-z]*\/)*([A-za-z]*)\/([A-Za-z_]*).png/);
// let type = texture[0]
// let name = texture[1]
console.log(texture)
}) })
}) })
} }

22
package-lock.json generated
View File

@ -9,7 +9,8 @@
"version": "1.0.0", "version": "1.0.0",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"decompress": "^4.2.1" "decompress": "^4.2.1",
"jsonfile": "^6.1.0"
} }
}, },
"node_modules/base64-js": { "node_modules/base64-js": {
@ -277,6 +278,17 @@
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="
}, },
"node_modules/jsonfile": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
"dependencies": {
"universalify": "^2.0.0"
},
"optionalDependencies": {
"graceful-fs": "^4.1.6"
}
},
"node_modules/make-dir": { "node_modules/make-dir": {
"version": "1.3.0", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz",
@ -456,6 +468,14 @@
"through": "^2.3.8" "through": "^2.3.8"
} }
}, },
"node_modules/universalify": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==",
"engines": {
"node": ">= 10.0.0"
}
},
"node_modules/util-deprecate": { "node_modules/util-deprecate": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",

View File

@ -4,11 +4,13 @@
"description": "L vipermc", "description": "L vipermc",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"start": "rm -r out && mkdir out && node index.js" "start": "rm -r out && mkdir out && node index.js",
"test": "clear && npm start"
}, },
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"decompress": "^4.2.1" "decompress": "^4.2.1",
"jsonfile": "^6.1.0"
} }
} }