"Clean" up code
This commit is contained in:
parent
e97a04a1e9
commit
137cd8eeca
13
README.md
Normal file
13
README.md
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# Pack Converter
|
||||||
|
## Progress:
|
||||||
|
### Currently working:
|
||||||
|
- Extract *some* 1.8 resource packs and rename blocks and items to their correct 1.20 names.
|
||||||
|
- Change format in pack.mcmeta
|
||||||
|
### Need to work on:
|
||||||
|
- Fixing textures
|
||||||
|
- Clock
|
||||||
|
- Compass
|
||||||
|
- Potion
|
||||||
|
- Fix "EISDIR" error with certain resource packs. (Prism as an example)
|
||||||
|
- Decide what to do with particles, as particles are split into separate files in 1.20.
|
||||||
|
- Implement a way to duplicate a texture and rename them to separate names (dye_powder_white -> bone_meal + white_dye) etc.
|
28
index.js
28
index.js
|
@ -13,26 +13,24 @@ jsonfile.readFile(itemRemaps, function (err, obj) {
|
||||||
if (err) console.error(err);
|
if (err) console.error(err);
|
||||||
items = obj;
|
items = obj;
|
||||||
});
|
});
|
||||||
|
let toConvertName;
|
||||||
|
|
||||||
/*
|
try {
|
||||||
TODO:
|
toConvertName = process.argv[2];
|
||||||
Textures to check in the future:
|
if (fs.existsSync(`input/${toConvertName}.zip`)) {
|
||||||
- Clock
|
convert(toConvertName);
|
||||||
- Compass
|
} else {
|
||||||
- Filled Map
|
console.log('Usage: npm start <pack name>');
|
||||||
- Potion
|
}
|
||||||
Fix "EISDIR" error.
|
} catch (err) {
|
||||||
*/
|
console.log(err);
|
||||||
|
}
|
||||||
extract('1.8');
|
|
||||||
extract('3Stimpy_War_Remake_v2');
|
|
||||||
// extract('! §fp§2ri§3sm §8[§f16§3x§8]'); for some reason prism errors???
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} input Name of resource pack zip file
|
* @param {string} input Name of resource pack zip file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function extract(input) {
|
function convert(input) {
|
||||||
const extractedPath = `out/${input}/assets/minecraft/textures/`;
|
const extractedPath = `out/${input}/assets/minecraft/textures/`;
|
||||||
decompress(`input/${input}.zip`, `out/${input}`).then(files => {
|
decompress(`input/${input}.zip`, `out/${input}`).then(files => {
|
||||||
files.forEach(element => {
|
files.forEach(element => {
|
||||||
|
@ -59,7 +57,7 @@ function extract(input) {
|
||||||
if (rename) {
|
if (rename) {
|
||||||
try {
|
try {
|
||||||
fs.renameSync(`${path1}${name}.${extension}`, `${path1}${rename}.${extension}`);
|
fs.renameSync(`${path1}${name}.${extension}`, `${path1}${rename}.${extension}`);
|
||||||
console.log(`Renamed ${path1}${name}.${extension} to ${path1}${rename}.${extension}`);
|
console.log(`Renamed ${name}.${extension} to ${rename}.${extension}`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue
Block a user