Support for 1.13+ Forge Resolution.
Tested versions: 1.13.2 TODO: Test 1.14.4, 1.15.1 TODO: Read mod metadata from mods.toml in 1.13+
This commit is contained in:
25
src/model/forge/versionmanifest113.ts
Normal file
25
src/model/forge/versionmanifest113.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
export interface VersionManifest113 {
|
||||
|
||||
id: string
|
||||
time: string
|
||||
releaseTime: string
|
||||
type: string
|
||||
mainClass: string
|
||||
inheritsFrom: string
|
||||
logging: any
|
||||
arguments: {
|
||||
game: string[]
|
||||
}
|
||||
libraries: Array<{
|
||||
name: string,
|
||||
downloads: {
|
||||
artifact: {
|
||||
path: string,
|
||||
url: string,
|
||||
sha1: string,
|
||||
size: number
|
||||
}
|
||||
}
|
||||
}>
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
export interface VersionManifest {
|
||||
export interface VersionManifest17 {
|
||||
|
||||
id: string
|
||||
time: string
|
||||
@@ -2,6 +2,9 @@ import { BaseMavenRepo } from './BaseMavenRepo'
|
||||
|
||||
export class LibRepoStructure extends BaseMavenRepo {
|
||||
|
||||
public static readonly MINECRAFT_GROUP = 'net.minecraft'
|
||||
public static readonly MINECRAFT_CLIENT_ARTIFACT = 'client'
|
||||
|
||||
constructor(
|
||||
absoluteRoot: string,
|
||||
relativeRoot: string
|
||||
|
||||
@@ -3,12 +3,14 @@ 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
|
||||
|
||||
constructor(
|
||||
absoluteRoot: string,
|
||||
@@ -18,6 +20,7 @@ export class RepoStructure extends BaseFileStructure {
|
||||
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() {
|
||||
@@ -25,6 +28,7 @@ export class RepoStructure extends BaseFileStructure {
|
||||
await this.forgeRepoStruct.init()
|
||||
await this.liteloaderRepoStruct.init()
|
||||
await this.libRepoStruct.init()
|
||||
await this.versionRepoStruct.init()
|
||||
}
|
||||
|
||||
public getForgeRepoStruct() {
|
||||
@@ -39,6 +43,10 @@ export class RepoStructure extends BaseFileStructure {
|
||||
return this.libRepoStruct
|
||||
}
|
||||
|
||||
public getVersionRepoStruct() {
|
||||
return this.versionRepoStruct
|
||||
}
|
||||
|
||||
public getTempDirectory() {
|
||||
return join(this.absoluteRoot, 'temp')
|
||||
}
|
||||
|
||||
28
src/model/struct/repo/versionrepo.struct.ts
Normal file
28
src/model/struct/repo/versionrepo.struct.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { join } from 'path'
|
||||
import { resolve as resolveURL } from 'url'
|
||||
import { BaseFileStructure } from '../BaseFileStructure'
|
||||
|
||||
export class VersionRepoStructure extends BaseFileStructure {
|
||||
|
||||
constructor(
|
||||
absoluteRoot: string,
|
||||
relativeRoot: string
|
||||
) {
|
||||
super(absoluteRoot, relativeRoot, 'versions')
|
||||
}
|
||||
|
||||
public getFileName(minecraftVersion: string, forgeVersion: string) {
|
||||
return `${minecraftVersion}-forge-${forgeVersion}`
|
||||
}
|
||||
|
||||
public getVersionManifest(minecraftVersion: string, forgeVersion: string) {
|
||||
const fileName = this.getFileName(minecraftVersion, forgeVersion)
|
||||
return join(this.containerDirectory, fileName, `${fileName}.json`)
|
||||
}
|
||||
|
||||
public getVersionManifestURL(url: string, minecraftVersion: string, forgeVersion: string) {
|
||||
const fileName = this.getFileName(minecraftVersion, forgeVersion)
|
||||
return resolveURL(url, join(this.relativeRoot, fileName, `${fileName}.json`))
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user