diff --git a/src/model/struct/repo/forgerepo.struct.ts b/src/model/struct/repo/forgerepo.struct.ts deleted file mode 100644 index 22de4c6..0000000 --- a/src/model/struct/repo/forgerepo.struct.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { BaseMavenRepo } from './BaseMavenRepo' - -export class ForgeRepoStructure extends BaseMavenRepo { - - public static readonly FORGE_GROUP = 'net.minecraftforge' - public static readonly FORGE_ARTIFACT = 'forge' - - constructor( - absoluteRoot: string, - relativeRoot: string - ) { - super(absoluteRoot, relativeRoot, 'forge') - } - - public getLocalForge(version: string, classifier?: string) { - return this.getArtifactByComponents( - ForgeRepoStructure.FORGE_GROUP, - ForgeRepoStructure.FORGE_ARTIFACT, - version, classifier, 'jar') - } - -} diff --git a/src/model/struct/repo/librepo.struct.ts b/src/model/struct/repo/librepo.struct.ts index 7d2cac9..d661d07 100644 --- a/src/model/struct/repo/librepo.struct.ts +++ b/src/model/struct/repo/librepo.struct.ts @@ -5,6 +5,12 @@ export class LibRepoStructure extends BaseMavenRepo { public static readonly MINECRAFT_GROUP = 'net.minecraft' public static readonly MINECRAFT_CLIENT_ARTIFACT = 'client' + public static readonly FORGE_GROUP = 'net.minecraftforge' + public static readonly FORGE_ARTIFACT = 'forge' + + public static readonly LITELOADER_GROUP = 'com.mumfrey' + public static readonly LITELOADER_ARTIFACT = 'liteloader' + constructor( absoluteRoot: string, relativeRoot: string @@ -12,4 +18,18 @@ export class LibRepoStructure extends BaseMavenRepo { super(absoluteRoot, relativeRoot, 'lib') } + public getLocalForge(version: string, classifier?: string) { + return this.getArtifactByComponents( + LibRepoStructure.FORGE_GROUP, + LibRepoStructure.FORGE_ARTIFACT, + version, classifier, 'jar') + } + + public getLocalLiteLoader(version: string, classifier?: string) { + return this.getArtifactByComponents( + LibRepoStructure.LITELOADER_GROUP, + LibRepoStructure.LITELOADER_ARTIFACT, + version, classifier, 'jar') + } + } diff --git a/src/model/struct/repo/liteloaderrepo.struct.ts b/src/model/struct/repo/liteloaderrepo.struct.ts deleted file mode 100644 index e36ea40..0000000 --- a/src/model/struct/repo/liteloaderrepo.struct.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { BaseMavenRepo } from './BaseMavenRepo' - -export class LiteLoaderRepoStructure extends BaseMavenRepo { - - constructor( - absoluteRoot: string, - relativeRoot: string - ) { - super(absoluteRoot, relativeRoot, 'liteloader') - } - - public getLocalLiteLoader(version: string, classifier?: string) { - return this.getArtifactByComponents('com.mumfrey', 'liteloader', version, classifier, 'jar') - } - -} diff --git a/src/model/struct/repo/repo.struct.ts b/src/model/struct/repo/repo.struct.ts index bc43bbe..29bb42b 100644 --- a/src/model/struct/repo/repo.struct.ts +++ b/src/model/struct/repo/repo.struct.ts @@ -1,14 +1,10 @@ import { join } from 'path' import { BaseFileStructure } from '../BaseFileStructure' -import { ForgeRepoStructure } from './forgerepo.struct' import { LibRepoStructure } from './librepo.struct' -import { LiteLoaderRepoStructure } from './liteloaderrepo.struct' import { VersionRepoStructure } from './versionrepo.struct' export class RepoStructure extends BaseFileStructure { - private forgeRepoStruct: ForgeRepoStructure - private liteloaderRepoStruct: LiteLoaderRepoStructure private libRepoStruct: LibRepoStructure private versionRepoStruct: VersionRepoStructure @@ -17,28 +13,16 @@ export class RepoStructure extends BaseFileStructure { relativeRoot: string ) { super(absoluteRoot, relativeRoot, 'repo') - this.forgeRepoStruct = new ForgeRepoStructure(this.containerDirectory, this.relativeRoot) - this.liteloaderRepoStruct = new LiteLoaderRepoStructure(this.containerDirectory, this.relativeRoot) this.libRepoStruct = new LibRepoStructure(this.containerDirectory, this.relativeRoot) this.versionRepoStruct = new VersionRepoStructure(this.containerDirectory, this.relativeRoot) } public async init() { super.init() - await this.forgeRepoStruct.init() - await this.liteloaderRepoStruct.init() await this.libRepoStruct.init() await this.versionRepoStruct.init() } - public getForgeRepoStruct() { - return this.forgeRepoStruct - } - - public getLiteLoaderRepoStruct() { - return this.liteloaderRepoStruct - } - public getLibRepoStruct() { return this.libRepoStruct } diff --git a/src/resolver/forge/adapter/forge113.resolver.ts b/src/resolver/forge/adapter/forge113.resolver.ts index 2a574ca..e1867d4 100644 --- a/src/resolver/forge/adapter/forge113.resolver.ts +++ b/src/resolver/forge/adapter/forge113.resolver.ts @@ -4,7 +4,6 @@ import { basename, dirname, join } from 'path' import { VersionManifest113 } from '../../../model/forge/versionmanifest113' import { Module } from '../../../model/spec/module' import { Type } from '../../../model/spec/type' -import { ForgeRepoStructure } from '../../../model/struct/repo/forgerepo.struct' import { LibRepoStructure } from '../../../model/struct/repo/librepo.struct' import { JavaUtil } from '../../../util/javautil' import { MavenUtil } from '../../../util/maven' @@ -36,15 +35,15 @@ export class Forge113Adapter extends ForgeResolver { } private async process() { - const forgeRepo = this.repoStructure.getForgeRepoStruct() - const installerPath = forgeRepo.getLocalForge(this.artifactVersion, 'installer') + const libRepo = this.repoStructure.getLibRepoStruct() + const installerPath = libRepo.getLocalForge(this.artifactVersion, 'installer') console.debug(`Checking for forge installer at ${installerPath}..`) - if (!await forgeRepo.artifactExists(installerPath)) { + if (!await libRepo.artifactExists(installerPath)) { console.debug(`Forge installer not found locally, initializing download..`) - await forgeRepo.downloadArtifactByComponents( + await libRepo.downloadArtifactByComponents( this.REMOTE_REPOSITORY, - ForgeRepoStructure.FORGE_GROUP, - ForgeRepoStructure.FORGE_ARTIFACT, + LibRepoStructure.FORGE_GROUP, + LibRepoStructure.FORGE_ARTIFACT, this.artifactVersion, 'installer', 'jar' ) } else { @@ -158,22 +157,22 @@ export class Forge113Adapter extends ForgeResolver { const generatedFiles = [ { name: 'base jar', - group: ForgeRepoStructure.FORGE_GROUP, - artifact: ForgeRepoStructure.FORGE_ARTIFACT, + group: LibRepoStructure.FORGE_GROUP, + artifact: LibRepoStructure.FORGE_ARTIFACT, version: this.artifactVersion, classifier: undefined }, { name: 'universal jar', - group: ForgeRepoStructure.FORGE_GROUP, - artifact: ForgeRepoStructure.FORGE_ARTIFACT, + group: LibRepoStructure.FORGE_GROUP, + artifact: LibRepoStructure.FORGE_ARTIFACT, version: this.artifactVersion, classifier: 'universal' }, { name: 'client jar', - group: ForgeRepoStructure.FORGE_GROUP, - artifact: ForgeRepoStructure.FORGE_ARTIFACT, + group: LibRepoStructure.FORGE_GROUP, + artifact: LibRepoStructure.FORGE_ARTIFACT, version: this.artifactVersion, classifier: 'client' }, diff --git a/src/resolver/forge/adapter/forge17.resolver.ts b/src/resolver/forge/adapter/forge17.resolver.ts index 8813fc3..d0a4248 100644 --- a/src/resolver/forge/adapter/forge17.resolver.ts +++ b/src/resolver/forge/adapter/forge17.resolver.ts @@ -5,7 +5,7 @@ import { basename, join } from 'path' import { VersionManifest17 } from '../../../model/forge/versionmanifest17' import { Module } from '../../../model/spec/module' import { Type } from '../../../model/spec/type' -import { ForgeRepoStructure } from '../../../model/struct/repo/forgerepo.struct' +import { LibRepoStructure } from '../../../model/struct/repo/librepo.struct' import { MavenUtil } from '../../../util/maven' import { PackXZExtractWrapper } from '../../../util/PackXZExtractWrapper' import { VersionUtil } from '../../../util/versionutil' @@ -36,15 +36,15 @@ export class Forge17Adapter extends ForgeResolver { } public async getForgeByVersion() { - const forgeRepo = this.repoStructure.getForgeRepoStruct() - const targetLocalPath = forgeRepo.getLocalForge(this.artifactVersion, 'universal') + const libRepo = this.repoStructure.getLibRepoStruct() + const targetLocalPath = libRepo.getLocalForge(this.artifactVersion, 'universal') console.debug(`Checking for forge version at ${targetLocalPath}..`) - if (!await forgeRepo.artifactExists(targetLocalPath)) { + if (!await libRepo.artifactExists(targetLocalPath)) { console.debug(`Forge not found locally, initializing download..`) - await forgeRepo.downloadArtifactByComponents( + await libRepo.downloadArtifactByComponents( this.REMOTE_REPOSITORY, - ForgeRepoStructure.FORGE_GROUP, - ForgeRepoStructure.FORGE_ARTIFACT, + LibRepoStructure.FORGE_GROUP, + LibRepoStructure.FORGE_ARTIFACT, this.artifactVersion, 'universal', 'jar') } else { console.debug('Using locally discovered forge.') @@ -72,8 +72,8 @@ export class Forge17Adapter extends ForgeResolver { const forgeModule: Module = { id: MavenUtil.mavenComponentsToIdentifier( - ForgeRepoStructure.FORGE_GROUP, - ForgeRepoStructure.FORGE_ARTIFACT, + LibRepoStructure.FORGE_GROUP, + LibRepoStructure.FORGE_ARTIFACT, this.artifactVersion, 'universal' ), name: 'Minecraft Forge', @@ -81,10 +81,10 @@ export class Forge17Adapter extends ForgeResolver { artifact: this.generateArtifact( forgeUniversalBuffer, await lstat(targetLocalPath), - forgeRepo.getArtifactUrlByComponents( + libRepo.getArtifactUrlByComponents( this.baseUrl, - ForgeRepoStructure.FORGE_GROUP, - ForgeRepoStructure.FORGE_ARTIFACT, + LibRepoStructure.FORGE_GROUP, + LibRepoStructure.FORGE_ARTIFACT, this.artifactVersion, 'universal' ) ), @@ -100,7 +100,6 @@ export class Forge17Adapter extends ForgeResolver { } console.debug(`Processing ${lib.name}..`) - const libRepo = this.repoStructure.getLibRepoStruct() const extension = this.determineExtension(lib.checksums) const localPath = libRepo.getArtifactById(lib.name, extension) as string