From 2f518e448727c01fc86f767cec866f3ac39d7ec6 Mon Sep 17 00:00:00 2001 From: Tianpao Date: Wed, 9 Jul 2025 19:15:59 +0800 Subject: [PATCH] =?UTF-8?q?refactor=EF=BC=9A=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/main.ts b/src/main.ts index 7d027a7..967d851 100644 --- a/src/main.ts +++ b/src/main.ts @@ -54,12 +54,13 @@ async function main(modpack_path: string) { yauzl.open(modpack_path, { lazyEntries: true }, (err, zipfile) => { zipfile.readEntry(); //首次读取 zipfile.on("entry", async (entry) => { - if (/\/$/.test(entry.fileName)) { - } else if (entry.fileName.includes("overrides/")) { + const name: string = entry.fileName; + if (/\/$/.test(name)) { + } else if (name.includes("overrides/")) { const zipfilex = join( unzip_path, zipname, - entry.fileName.replace("overrides/", "") + name.replace("overrides/", "") ); if (!fs.existsSync(zipfilex)) { zipfile.openReadStream(entry, (err, stream) => { @@ -69,18 +70,14 @@ async function main(modpack_path: string) { console.log(zipfilex); stream.pipe(fse.createWriteStream(zipfilex)); }); - //console.log(entry.fileName) } - } else { - const name: string = entry.fileName; - dud_files.push(name); - if (name.endsWith(".json")) { + } else if (name.endsWith(".json")||name.includes("mcbbs.packmeta")) { + dud_files.push(name); //console.log((await readzipentry(zipfile, entry))) pack_info = JSON.parse( (await readzipentry(zipfile, entry)).toString() ); } - } zipfile.readEntry(); }); zipfile.on("end", async () => { @@ -93,7 +90,7 @@ async function main(modpack_path: string) { await install(info.loader, info.minecraft, info.loader_version, dirx); fs.writeFileSync( join(dirx, "instance.zip"), - "#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://aka.ms/MinecraftEULA).\n#This serverpack created by DeEarthX\neula=true" + "#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://aka.ms/MinecraftEULA).\n#This serverpack created by DeEarthX(QQ_Group:559349662)\neula=true" ); LOGGER.info("DeEarthX已将服务端制作完成!"); zipfile.close();