Skip to content

Commit

Permalink
4.0.0-alpha.7
Browse files Browse the repository at this point in the history
  • Loading branch information
heipiao233 committed Aug 2, 2023
1 parent 172c621 commit 840f9d1
Show file tree
Hide file tree
Showing 10 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.6
4.0.0-alpha.7
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.6",
"version": "4.0.0-alpha.7",
"description": "Dolphin Minecraft Launcher Core",
"typings": "./lib/index.d.ts",
"module": "./lib/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/auth/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface Account<T extends UserData> {
/**
* Prepare for launch. For example, download your Java Agent.
*/
prepareLaunch(): Promise<boolean>
prepareLaunch(versionDir: string): Promise<boolean>
/**
* Get extra JVM arguments. For example, Java Agent.
*/
Expand Down
4 changes: 2 additions & 2 deletions src/auth/ali_account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ export class AuthlibInjectorAccount extends YggdrasilAccount<YggdrasilUserData>
return await super.login();
}

async prepareLaunch(): Promise<boolean> {
async prepareLaunch(versionDir: string): Promise<boolean> {
const obj = await got("https://bmclapi2.bangbang93.com/mirrors/authlib-injector/artifact/latest.json").json<AuthlibInjectorArtifact>();
const sha256 = obj.checksums.sha256;
const path = `${this.root.toString()}/authlib-injector-latest.jar`;
const path = `${versionDir}/authlib-injector-latest.jar`;
if (!fs.existsSync(path) || !checkFile(path, sha256, "sha256")) {
return await download(obj.download_url, path, this.launcher);
}
Expand Down
6 changes: 3 additions & 3 deletions src/auth/mul_account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ export class MinecraftUniversalLoginAccount extends YggdrasilAccount<MinecraftUn
return await super.login();
}

async prepareLaunch (): Promise<boolean> {
const path = `${this.root}/nide8auth.jar`;
async prepareLaunch(versionDir: string): Promise<boolean> {
const path = `${versionDir}/nide8auth.jar`;
if (!fs.existsSync(path)) {
return await download("https://login.mc-user.com:233/index/jar", path, this.launcher);
}
return true;
}

async getLaunchJVMArgs (): Promise<string[]> {
async getLaunchJVMArgs(): Promise<string[]> {
return [`-javaagent:./nide8auth.jar=${this.data.serverID}`, "-Dnide8auth.client=true"];
}
toString (): string {
Expand Down
2 changes: 1 addition & 1 deletion src/auth/yggdrasil/yggdrasil_account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export abstract class YggdrasilAccount<T extends YggdrasilUserData> implements A
this.root = launcher.rootPath;
}

abstract prepareLaunch(): Promise<boolean>;
abstract prepareLaunch(versionDir: string): Promise<boolean>;
abstract getLaunchJVMArgs(mc: MinecraftVersion): Promise<string[]>;
async getLaunchGameArgs(): Promise<Map<string, string>> {
const map: Map<string, string> = new Map();
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 = "";
version = "4.0.0-alpha.6";
static readonly version = "4.0.0-alpha.7";
/**
* Create a new Launcher object.
* @throws {@link FormattedError}
Expand Down
5 changes: 3 additions & 2 deletions src/mods/manage/ModManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export class ModManager {

async saveInfo(): Promise<void> {}

async findMods(moddir: string): Promise<ModJarInfo[]> {
async findMods(): Promise<ModJarInfo[]> {
const moddir = `${this.version.versionLaunchWorkDir}/mods`;
const val: ModJarInfo[] = [];
for (const mod of await fsPromises.readdir(moddir)) {
const modJar = `${moddir}/${mod}`;
Expand All @@ -33,7 +34,7 @@ export class ModManager {
let moddir = `${this.version.versionLaunchWorkDir}/mods`;
if (!fs.existsSync(moddir) && fs.statSync(moddir).isDirectory()) return [];
const loader = this.launcher.loaders.get(this.version.extras.loaders[0].name);
return loader?.checkMods((await this.findMods(moddir)).map(v=>v.manifests).flat(), this.version.extras.version, this.version.extras.loaders[0].version) ?? [];
return loader?.checkMods((await this.findMods()).map(v=>v.manifests).flat(), this.version.extras.version, this.version.extras.loaders[0].version) ?? [];
}

async searchMod(name: string, skip: number, limit: number): Promise<Content[]> {
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export class MinecraftVersion {
* @returns The Minecraft process. Both stdout and stderr uses UTF-8.
*/
async run(account: Account<never>): Promise<ChildProcess> {
await account.prepareLaunch();
await account.prepareLaunch(this.versionLaunchWorkDir);
await this.completeVersionInstall();
await this.extractNative(this.versionObject, this.name);
const args = await this.getArguments(this.versionObject, account);
Expand Down

0 comments on commit 840f9d1

Please sign in to comment.