feat: 1.20 support and allow versions without patch number
This commit is contained in:
committed by
Daniel Scalzi
parent
340df4f2d0
commit
3ec535de53
@@ -33,7 +33,7 @@ export class ForgeGradle3Adapter extends ForgeResolver {
|
|||||||
if(version.getMinor() === 12 && VersionUtil.isOneDotTwelveFG2(libraryVersion)) {
|
if(version.getMinor() === 12 && VersionUtil.isOneDotTwelveFG2(libraryVersion)) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return VersionUtil.isVersionAcceptable(version, [12, 13, 14, 15, 16, 17, 18, 19])
|
return VersionUtil.isVersionAcceptable(version, [12, 13, 14, 15, 16, 17, 18, 19, 20])
|
||||||
}
|
}
|
||||||
|
|
||||||
private generatedFiles: GeneratedFile[] | undefined
|
private generatedFiles: GeneratedFile[] | undefined
|
||||||
@@ -57,7 +57,7 @@ export class ForgeGradle3Adapter extends ForgeResolver {
|
|||||||
const is117OrGreater = this.minecraftVersion.getMinor() >= 17
|
const is117OrGreater = this.minecraftVersion.getMinor() >= 17
|
||||||
|
|
||||||
// Configure for 13, 14, 15, 16, 17, 18, 19
|
// Configure for 13, 14, 15, 16, 17, 18, 19
|
||||||
if(VersionUtil.isVersionAcceptable(this.minecraftVersion, [13, 14, 15, 16, 17, 18, 19])) {
|
if(VersionUtil.isVersionAcceptable(this.minecraftVersion, [13, 14, 15, 16, 17, 18, 19, 20])) {
|
||||||
|
|
||||||
// https://github.com/MinecraftForge/MinecraftForge/commit/97d4652f5fe15931b980117efabdff332f9f6428
|
// https://github.com/MinecraftForge/MinecraftForge/commit/97d4652f5fe15931b980117efabdff332f9f6428
|
||||||
const mcpUnifiedVersion = `${this.minecraftVersion}-${ForgeGradle3Adapter.WILDCARD_MCP_VERSION}`
|
const mcpUnifiedVersion = `${this.minecraftVersion}-${ForgeGradle3Adapter.WILDCARD_MCP_VERSION}`
|
||||||
@@ -116,7 +116,7 @@ export class ForgeGradle3Adapter extends ForgeResolver {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(VersionUtil.isVersionAcceptable(this.minecraftVersion, [17, 18, 19])) {
|
if(VersionUtil.isVersionAcceptable(this.minecraftVersion, [17, 18, 19, 20])) {
|
||||||
|
|
||||||
// Added in 1.17+
|
// Added in 1.17+
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ export class ForgeGradle3Adapter extends ForgeResolver {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VersionUtil.isVersionAcceptable(this.minecraftVersion, [18, 19])) {
|
if (VersionUtil.isVersionAcceptable(this.minecraftVersion, [18, 19, 20])) {
|
||||||
|
|
||||||
// Added in 1.18+
|
// Added in 1.18+
|
||||||
|
|
||||||
@@ -508,7 +508,6 @@ export class ForgeGradle3Adapter extends ForgeResolver {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
const destination = libRepo.getArtifactByComponents(
|
const destination = libRepo.getArtifactByComponents(
|
||||||
components.group,
|
components.group,
|
||||||
components.artifact,
|
components.artifact,
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export class ForgeModStructure113 extends BaseForgeModStructure {
|
|||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
public static isForVersion(version: MinecraftVersion, libraryVersion: string): boolean {
|
public static isForVersion(version: MinecraftVersion, libraryVersion: string): boolean {
|
||||||
return VersionUtil.isVersionAcceptable(version, [13, 14, 15, 16, 17, 18, 19])
|
return VersionUtil.isVersionAcceptable(version, [13, 14, 15, 16, 17, 18, 19, 20])
|
||||||
}
|
}
|
||||||
|
|
||||||
private forgeModMetadata: {[property: string]: ModsToml | undefined} = {}
|
private forgeModMetadata: {[property: string]: ModsToml | undefined} = {}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ export class MavenUtil {
|
|||||||
public static mavenComponentsToString(
|
public static mavenComponentsToString(
|
||||||
group: string, artifact: string, version: string, classifier?: string, extension = 'jar'
|
group: string, artifact: string, version: string, classifier?: string, extension = 'jar'
|
||||||
): string {
|
): string {
|
||||||
return `${group.replace(/\./g, '/')}/${artifact}/${version}/${artifact}-${version}${classifier != null ? `-${classifier}` : ''}.${extension}`
|
return `${group.replace(/\./g, '/').replace(/:/g, '/')}/${artifact}/${version}/${artifact}-${version}${classifier != null ? `-${classifier}` : ''}.${extension}`
|
||||||
}
|
}
|
||||||
|
|
||||||
public static mavenIdentifierToUrl(id: string, extension = 'jar'): URL {
|
public static mavenIdentifierToUrl(id: string, extension = 'jar'): URL {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
export class MinecraftVersion {
|
export class MinecraftVersion {
|
||||||
|
|
||||||
private static readonly MINECRAFT_VERSION_REGEX = /(\d+).(\d+).(\d+)/
|
private static readonly MINECRAFT_VERSION_REGEX = /(\d+).(\d+).?(\d+)?/
|
||||||
|
|
||||||
private readonly major: number
|
private readonly major: number
|
||||||
private readonly minor: number
|
private readonly minor: number
|
||||||
@@ -11,7 +11,7 @@ export class MinecraftVersion {
|
|||||||
if(res != null) {
|
if(res != null) {
|
||||||
this.major = Number(res[1])
|
this.major = Number(res[1])
|
||||||
this.minor = Number(res[2])
|
this.minor = Number(res[2])
|
||||||
this.revision = Number(res[3])
|
this.revision = Number(res[3]) ?? undefined
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`${version} is not a valid minecraft version!`)
|
throw new Error(`${version} is not a valid minecraft version!`)
|
||||||
}
|
}
|
||||||
@@ -23,8 +23,8 @@ export class MinecraftVersion {
|
|||||||
|
|
||||||
public getMajor(): number { return this.major }
|
public getMajor(): number { return this.major }
|
||||||
public getMinor(): number { return this.minor }
|
public getMinor(): number { return this.minor }
|
||||||
public getRevision(): number { return this.revision }
|
public getRevision(): number|undefined { return this.revision }
|
||||||
|
|
||||||
public toString(): string { return `${this.major}.${this.minor}.${this.revision}`}
|
public toString(): string { return `${this.major}.${this.minor}${this.revision? '.'+this.revision:''}`}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@ export class VersionUtil {
|
|||||||
'latest'
|
'latest'
|
||||||
]
|
]
|
||||||
|
|
||||||
public static readonly MINECRAFT_VERSION_REGEX = /(\d+).(\d+).(\d+)/
|
public static readonly MINECRAFT_VERSION_REGEX = /(\d+).(\d+).?(\d+)?/
|
||||||
|
|
||||||
public static isVersionAcceptable(version: MinecraftVersion, acceptable: number[]): boolean {
|
public static isVersionAcceptable(version: MinecraftVersion, acceptable: number[]): boolean {
|
||||||
if (version.getMajor() === 1) {
|
if (version.getMajor() === 1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user