Skip to content

Commit

Permalink
4.3.0-beta.4: Fix Neo install
Browse files Browse the repository at this point in the history
Signed-off-by: 黑嫖233 <[email protected]>
  • Loading branch information
heipiao233 committed Feb 6, 2024
1 parent df71b92 commit 77cbdaa
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion locales/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.3.0-beta.3
4.3.0-beta.4
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.3.0-beta.3",
"version": "4.3.0-beta.4",
"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 @@ -106,7 +106,7 @@ export class Launcher {
specialNatives: Record<string, Library>;
};
private realRootPath = "";
static readonly version = "4.3.0-beta.3";
static readonly version = "4.3.0-beta.4";
/**
* Create a new Launcher object.
* @throws {@link FormattedError}
Expand Down
4 changes: 4 additions & 0 deletions src/loaders/forge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ export class ForgeLoader extends ForgeLikeLoader {
protected supportsOld = false;
name = "forge";

matchVersion(loader: string, mc: string): boolean {
return loader.startsWith(`${mc}-`);
}

getArchiveBaseName(MCVersion: string): string {
return "forge";
}
Expand Down
3 changes: 2 additions & 1 deletion src/loaders/forgelike/forgelike.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export abstract class ForgeLikeLoader implements Loader<StoreData | ForgeMcmodIn

abstract findInVersion(MCVersion: MCVersion): string | undefined;
abstract getArchiveBaseName(MCVersion: string): string;
abstract matchVersion(loader: string, mc: string): boolean;

async getSuitableLoaderVersions (MCVersion: MinecraftVersion): Promise<string[]> {
if(MCVersion.extras.version === "Unknown") {
Expand All @@ -48,7 +49,7 @@ export abstract class ForgeLikeLoader implements Loader<StoreData | ForgeMcmodIn
const res = await got(`${this.mavenArtifactURL}/${this.getArchiveBaseName(MCVersion.extras.version)}/maven-metadata.xml`);
const obj = await parseStringPromise(res.body);
const versions: string[] = obj.metadata.versioning[0].versions[0].version;
return versions.filter((v: string) => v.startsWith(`${MCVersion.extras.version}-`));
return versions.filter((v: string) => this.matchVersion(v, MCVersion.extras.version));
}

async install (MCVersion: MinecraftVersion, version: string): Promise<boolean> {
Expand Down
9 changes: 8 additions & 1 deletion src/loaders/neoforge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@ export class NeoForgeLoader extends ForgeLikeLoader {
protected supportsOld = false;
name = "neoforge";

matchVersion(loader: string, mc: string): boolean {
if (mc === "1.20.1") {
return loader.startsWith("1.20.1-");
} else if (mc.includes("-") || mc.includes("w")) return false;
return loader.startsWith(mc.slice(2));
}

getArchiveBaseName(MCVersion: string): string {
if (MCVersion.startsWith("1.20.1")) {
if (MCVersion === "1.20.1") {
return "forge";
}
return "neoforge";
Expand Down

0 comments on commit 77cbdaa

Please sign in to comment.