"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);
|
||||
items = obj;
|
||||
});
|
||||
let toConvertName;
|
||||
|
||||
/*
|
||||
TODO:
|
||||
Textures to check in the future:
|
||||
- Clock
|
||||
- Compass
|
||||
- Filled Map
|
||||
- Potion
|
||||
Fix "EISDIR" error.
|
||||
*/
|
||||
|
||||
extract('1.8');
|
||||
extract('3Stimpy_War_Remake_v2');
|
||||
// extract('! §fp§2ri§3sm §8[§f16§3x§8]'); for some reason prism errors???
|
||||
try {
|
||||
toConvertName = process.argv[2];
|
||||
if (fs.existsSync(`input/${toConvertName}.zip`)) {
|
||||
convert(toConvertName);
|
||||
} else {
|
||||
console.log('Usage: npm start <pack name>');
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} input Name of resource pack zip file
|
||||
*/
|
||||
|
||||
function extract(input) {
|
||||
function convert(input) {
|
||||
const extractedPath = `out/${input}/assets/minecraft/textures/`;
|
||||
decompress(`input/${input}.zip`, `out/${input}`).then(files => {
|
||||
files.forEach(element => {
|
||||
|
@ -59,7 +57,7 @@ function extract(input) {
|
|||
if (rename) {
|
||||
try {
|
||||
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) {
|
||||
console.log(error);
|
||||
}
|
||||
|
|
Reference in New Issue
Block a user