From 8e5d9cc75c76db78ce935ef647fd9f1adb98c763 Mon Sep 17 00:00:00 2001 From: heipiao233 Date: Wed, 2 Aug 2023 19:56:48 +0800 Subject: [PATCH] 4.0.0-alpha.8 --- locales/version | 2 +- package-lock.json | 4 ++-- package.json | 2 +- src/launcher.ts | 2 +- src/loaders/fabriclike/fabriclike.ts | 4 ++-- src/loaders/forge/forge.ts | 6 +++--- src/loaders/quilt/quilt.ts | 2 +- src/mods/mod.ts | 9 +++++---- 8 files changed, 16 insertions(+), 15 deletions(-) diff --git a/locales/version b/locales/version index 110ab5a..98f3b7d 100644 --- a/locales/version +++ b/locales/version @@ -1 +1 @@ -4.0.0-alpha.7 \ No newline at end of file +4.0.0-alpha.8 \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index a783ae6..4e71832 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "dmclc", - "version": "4.0.0-alpha.7", + "version": "4.0.0-alpha.8", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "dmclc", - "version": "4.0.0-alpha.7", + "version": "4.0.0-alpha.8", "license": "MIT", "dependencies": { "@types/marked": "^4.0.8", diff --git a/package.json b/package.json index 93b3ebf..c5caca5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dmclc", - "version": "4.0.0-alpha.7", + "version": "4.0.0-alpha.8", "description": "Dolphin Minecraft Launcher Core", "typings": "./lib/index.d.ts", "module": "./lib/index.js", diff --git a/src/launcher.ts b/src/launcher.ts index 94d3fad..aab9f35 100644 --- a/src/launcher.ts +++ b/src/launcher.ts @@ -63,7 +63,7 @@ export class Launcher { specialNatives: Record; }; private realRootPath = ""; - static readonly version = "4.0.0-alpha.7"; + static readonly version = "4.0.0-alpha.8"; /** * Create a new Launcher object. * @throws {@link FormattedError} diff --git a/src/loaders/fabriclike/fabriclike.ts b/src/loaders/fabriclike/fabriclike.ts index 13b2cab..2bb7343 100644 --- a/src/loaders/fabriclike/fabriclike.ts +++ b/src/loaders/fabriclike/fabriclike.ts @@ -18,7 +18,7 @@ export abstract class FabricLikeLoader imple abstract loaderMaven: string; abstract metaURL: string; intermediaryMaven = "https://maven.fabricmc.net/"; - private readonly launcher: Launcher; + protected readonly launcher: Launcher; constructor (launcher: Launcher) { this.launcher = launcher; } @@ -43,7 +43,7 @@ export abstract class FabricLikeLoader imple } } await zip.close(); - const info = new ModInfo("fabric", json); + const info = new ModInfo("fabric", json, this.launcher); info.data = json; result.push(info); return result; diff --git a/src/loaders/forge/forge.ts b/src/loaders/forge/forge.ts index 37f366c..9f6c43a 100644 --- a/src/loaders/forge/forge.ts +++ b/src/loaders/forge/forge.ts @@ -165,19 +165,19 @@ export class ForgeLoader implements Loader { info: i, deps: data.dependencies[i.modId], jar: data - })); + }, this.launcher)); else ret.push(new ModInfo("forge", { info: i, jar: data - })); + }, this.launcher)); } } const oldEntry = await zip.entry("mcmod.info"); if(oldEntry) { const data: ForgeMcmodInfo = JSON.parse((await zip.entryData(oldEntry)).toString()); for (const i of data) { - ret.push(new ModInfo("forge", i)); + ret.push(new ModInfo("forge", i, this.launcher)); } } await zip.close(); diff --git a/src/loaders/quilt/quilt.ts b/src/loaders/quilt/quilt.ts index 5108c9d..10f67bb 100644 --- a/src/loaders/quilt/quilt.ts +++ b/src/loaders/quilt/quilt.ts @@ -36,7 +36,7 @@ export class QuiltLoader extends FabricLikeLoader { - constructor(public loader: string, public data: T) {} + constructor(public loader: string, public data: T, private launcher: Launcher) {} - getInfo(launcher: Launcher): ModDisplayInfo { - return launcher.loaders.get(this.loader)!.getModInfo(this.data); + getInfo(): ModDisplayInfo { + return this.launcher.loaders.get(this.loader)!.getModInfo(this.data); } } @@ -30,9 +30,10 @@ export class ModJarInfo { // Some mod jars may have two or more manifests for many loaders. // For example, there are both META-INF/mods.toml and fabric.mod.json in a jar. manifests: ModInfo[] = []; - private constructor(public path: string, private launcher: Launcher) { + private constructor(public readonly path: string, private readonly launcher: Launcher) { // do nothing } + static async of(path: string, launcher: Launcher, loaders: string[]): Promise { const obj = new ModJarInfo(path, launcher); for (const name of loaders) {