Skip to content

Commit

Permalink
4.0.0-alpha.8
Browse files Browse the repository at this point in the history
  • Loading branch information
heipiao233 committed Aug 2, 2023
1 parent a74c908 commit 8e5d9cc
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion locales/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0.0-alpha.7
4.0.0-alpha.8
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class Launcher {
specialNatives: Record<string, Library>;
};
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}
Expand Down
4 changes: 2 additions & 2 deletions src/loaders/fabriclike/fabriclike.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export abstract class FabricLikeLoader<T extends FabricLikeVersionInfo, M> 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;
}
Expand All @@ -43,7 +43,7 @@ export abstract class FabricLikeLoader<T extends FabricLikeVersionInfo, M> 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;
Expand Down
6 changes: 3 additions & 3 deletions src/loaders/forge/forge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,19 +165,19 @@ export class ForgeLoader implements Loader<StoreData | ForgeMcmodInfoOne> {
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();
Expand Down
2 changes: 1 addition & 1 deletion src/loaders/quilt/quilt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class QuiltLoader extends FabricLikeLoader<QuiltVersionInfo, QuiltModJson
result.push(...await this.findModInfos(filename));
}
}
const info = new ModInfo("quilt", json);
const info = new ModInfo("quilt", json, this.launcher);
info.data = json;
result.push(info);
return result;
Expand Down
9 changes: 5 additions & 4 deletions src/mods/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,21 @@ export function modDisplayInfoToString(launcher: Launcher, mod: ModDisplayInfo)
}

export class ModInfo<T> {
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);
}
}

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<unknown>[] = [];
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<ModJarInfo> {
const obj = new ModJarInfo(path, launcher);
for (const name of loaders) {
Expand Down

0 comments on commit 8e5d9cc

Please sign in to comment.