feat:fabric启动脚本,垃圾回收,rubbish改名 fix:json解析失败崩溃

This commit is contained in:
Tianpao
2025-07-26 16:27:14 +08:00
parent d8d8c4051a
commit 9d77fa53c7
4 changed files with 39 additions and 6 deletions

View File

@@ -19,7 +19,7 @@ export async function DeEarthMain(modspath: string, movepath: any) {
}
LOGGER.info(`DeEarth V1.0.0`)
LOGGER.info(`如有无法筛选的mods请前往 https://dearth.0771010.xyz/ 提交未成功筛选的模组的modid`)
LOGGER.info(`Probejs 7.0.0以上版本为非客户端mod如rubbish中有请自行添加回去`)
LOGGER.info(`Probejs 7.0.0以上版本为非客户端mod.rubbish中有请自行添加回去`)
const resaddr = fs.readdirSync(modspath)
LOGGER.info(`获取目录列表,一共${resaddr.length}个jar文件。`)
const totalBar = multibar.create(resaddr.length, 0, { filename: '总文件数' })
@@ -138,6 +138,7 @@ export async function DeEarth(modpath: string, movepath: string) {
export async function DeEarth(modpath: string, movepath: string) {
const zipinfo = ZipInfo(modpath)
let modid:string = ""
if(zipinfo){
if(zipinfo.modinfo.type === "forge"){
modid = zipinfo.modinfo.data.mods[0].modId
}else if(zipinfo.modinfo.type === "fabric"){
@@ -189,6 +190,7 @@ export async function DeEarth(modpath: string, movepath: string) {
}catch(error){
LOGGER.error(`大天才JSON写注释了估计模组路径:${modpath},过滤失败`)
}
}
}
}
}
@@ -199,6 +201,7 @@ function ZipInfo(modpath: string) {
mixins: { filename: string, info: string }[]
modinfo: {type:string,data:any};
}
try{
let zipinfo: ZipInfo = { mixins: [], modinfo: {type: "",data: {}} }
const zip = new AdmZip(modpath).getEntries();
for (let i = 0; i < zip.length; i++) {
@@ -214,6 +217,9 @@ function ZipInfo(modpath: string) {
}
}
return zipinfo;
}catch(error){
LOGGER.error(error)
}
}
async function FastGot(url: string) {