From ea56258deef065a71ea7b1e29eebd0af59823ad9 Mon Sep 17 00:00:00 2001 From: Tianpao Date: Wed, 2 Jul 2025 20:00:26 +0800 Subject: [PATCH] =?UTF-8?q?update=EF=BC=9A=E5=90=8C=E6=AD=A5DeEarth?= =?UTF-8?q?=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/DeEarth.ts | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/utils/DeEarth.ts b/src/utils/DeEarth.ts index e955014..4152b74 100644 --- a/src/utils/DeEarth.ts +++ b/src/utils/DeEarth.ts @@ -56,6 +56,24 @@ export async function DeEarth(modpath: string, movepath: string) { } } } catch (error) { //mods.toml或fabric.mod.json判断 + try{//DeEarthPublic + for (let i = 0; i < zip.length; i++) { + const e = zip[i] + if (e.entryName == "META-INF/mods.toml") { //Forge,Neoforge + const modid = toml.parse(e.getData().toString('utf-8')).mods[0].modId + const body = JSON.parse(await FastGot(`https://dearth.0771010.xyz/api/modid?modid=${modid}`)) + if (body.isClient) { + fs.renameSync(modpath, `${movepath}/${path.basename(modpath)}`) + } + } else if (e.entryName == "fabric.mod.json") { //Fabric + const modid = JSON.parse(e.getData().toString('utf-8')).id + const body = JSON.parse(await FastGot(`https://dearth.0771010.xyz/api/modid?modid=${modid}`)) + if (body.isClient) { + fs.renameSync(modpath, `${movepath}/${path.basename(modpath)}`) + } + } + } + }catch(errorr){ for (let i = 0; i < zip.length; i++) { const e = zip[i] try { @@ -101,7 +119,7 @@ export async function DeEarth(modpath: string, movepath: string) { } } } - //} + } } async function FastGot(url: string) {