1.17+ Support / Java Settings by Instance (#50)
* Initial 1.17 configuration, dep upgrade. * Enable 1.18 for initial tests. * Add lowcodelanguage for 1.18 (#49) * Set classpath flag for 1.17+ generated files. Enable 1.19 (not yet working). * Support 1.19. Co-authored-by: Matt Artist <me@mja00.dev>
This commit is contained in:
@@ -19,6 +19,7 @@ interface GeneratedFile {
|
||||
version: string
|
||||
classifiers: string[] | [undefined]
|
||||
skipIfNotPresent?: boolean
|
||||
classpath?: boolean
|
||||
}
|
||||
|
||||
export class ForgeGradle3Adapter extends ForgeResolver {
|
||||
@@ -31,7 +32,7 @@ export class ForgeGradle3Adapter extends ForgeResolver {
|
||||
if(version.getMinor() === 12 && VersionUtil.isOneDotTwelveFG2(libraryVersion)) {
|
||||
return false
|
||||
}
|
||||
return VersionUtil.isVersionAcceptable(version, [12, 13, 14, 15, 16])
|
||||
return VersionUtil.isVersionAcceptable(version, [12, 13, 14, 15, 16, 17, 18, 19])
|
||||
}
|
||||
|
||||
private generatedFiles: GeneratedFile[] | undefined
|
||||
@@ -51,33 +52,31 @@ export class ForgeGradle3Adapter extends ForgeResolver {
|
||||
}
|
||||
|
||||
private configure(): void {
|
||||
// Configure for 13, 14, 15, 16
|
||||
if(VersionUtil.isVersionAcceptable(this.minecraftVersion, [13, 14, 15, 16])) {
|
||||
|
||||
const is117OrGreater = this.minecraftVersion.getMinor() >= 17
|
||||
|
||||
// Configure for 13, 14, 15, 16, 17, 18, 19
|
||||
if(VersionUtil.isVersionAcceptable(this.minecraftVersion, [13, 14, 15, 16, 17, 18, 19])) {
|
||||
|
||||
// https://github.com/MinecraftForge/MinecraftForge/commit/97d4652f5fe15931b980117efabdff332f9f6428
|
||||
const mcpUnifiedVersion = `${this.minecraftVersion}-${ForgeGradle3Adapter.WILDCARD_MCP_VERSION}`
|
||||
|
||||
this.generatedFiles = [
|
||||
{
|
||||
name: 'base jar',
|
||||
group: LibRepoStructure.FORGE_GROUP,
|
||||
artifact: LibRepoStructure.FORGE_ARTIFACT,
|
||||
version: this.artifactVersion,
|
||||
classifiers: [undefined]
|
||||
},
|
||||
{
|
||||
name: 'universal jar',
|
||||
group: LibRepoStructure.FORGE_GROUP,
|
||||
artifact: LibRepoStructure.FORGE_ARTIFACT,
|
||||
version: this.artifactVersion,
|
||||
classifiers: ['universal']
|
||||
classifiers: ['universal'],
|
||||
classpath: !is117OrGreater
|
||||
},
|
||||
{
|
||||
name: 'client jar',
|
||||
group: LibRepoStructure.FORGE_GROUP,
|
||||
artifact: LibRepoStructure.FORGE_ARTIFACT,
|
||||
version: this.artifactVersion,
|
||||
classifiers: ['client']
|
||||
classifiers: ['client'],
|
||||
classpath: !is117OrGreater
|
||||
},
|
||||
{
|
||||
name: 'client data',
|
||||
@@ -85,22 +84,85 @@ export class ForgeGradle3Adapter extends ForgeResolver {
|
||||
artifact: LibRepoStructure.MINECRAFT_CLIENT_ARTIFACT,
|
||||
version: this.minecraftVersion.toString(),
|
||||
classifiers: ['data'],
|
||||
skipIfNotPresent: true
|
||||
skipIfNotPresent: true,
|
||||
classpath: !is117OrGreater
|
||||
},
|
||||
{
|
||||
name: 'client srg',
|
||||
group: LibRepoStructure.MINECRAFT_GROUP,
|
||||
artifact: LibRepoStructure.MINECRAFT_CLIENT_ARTIFACT,
|
||||
version: mcpUnifiedVersion,
|
||||
classifiers: ['srg']
|
||||
classifiers: ['srg'],
|
||||
classpath: !is117OrGreater
|
||||
}
|
||||
]
|
||||
this.wildcardsInUse = [
|
||||
ForgeGradle3Adapter.WILDCARD_MCP_VERSION
|
||||
]
|
||||
|
||||
if(VersionUtil.isVersionAcceptable(this.minecraftVersion, [13, 14, 15, 16])) {
|
||||
|
||||
// Base jar present for 1.13-1.16
|
||||
|
||||
this.generatedFiles.unshift(
|
||||
{
|
||||
name: 'base jar',
|
||||
group: LibRepoStructure.FORGE_GROUP,
|
||||
artifact: LibRepoStructure.FORGE_ARTIFACT,
|
||||
version: this.artifactVersion,
|
||||
classifiers: [undefined]
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
if(VersionUtil.isVersionAcceptable(this.minecraftVersion, [17, 18, 19])) {
|
||||
|
||||
// Added in 1.17+
|
||||
|
||||
this.generatedFiles.unshift(
|
||||
{
|
||||
name: 'fmlcore',
|
||||
group: LibRepoStructure.FORGE_GROUP,
|
||||
artifact: LibRepoStructure.FMLCORE_ARTIFACT,
|
||||
version: this.artifactVersion,
|
||||
classifiers: [undefined]
|
||||
},
|
||||
{
|
||||
name: 'javafmllanguage',
|
||||
group: LibRepoStructure.FORGE_GROUP,
|
||||
artifact: LibRepoStructure.JAVAFMLLANGUAGE_ARTIFACT,
|
||||
version: this.artifactVersion,
|
||||
classifiers: [undefined]
|
||||
},
|
||||
{
|
||||
name: 'mclanguage',
|
||||
group: LibRepoStructure.FORGE_GROUP,
|
||||
artifact: LibRepoStructure.MCLANGUAGE_ARTIFACT,
|
||||
version: this.artifactVersion,
|
||||
classifiers: [undefined]
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
if (VersionUtil.isVersionAcceptable(this.minecraftVersion, [18, 19])) {
|
||||
|
||||
// Added in 1.18+
|
||||
|
||||
this.generatedFiles.unshift(
|
||||
{
|
||||
name: 'lowcodelanguage',
|
||||
group: LibRepoStructure.FORGE_GROUP,
|
||||
artifact: LibRepoStructure.LOWCODELANGUAGE_ARTIFACT,
|
||||
version: this.artifactVersion,
|
||||
classifiers: [undefined]
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
if(VersionUtil.isVersionAcceptable(this.minecraftVersion, [13, 14, 15])) {
|
||||
|
||||
// 13, 14, 15 use just the MC version.
|
||||
|
||||
this.generatedFiles.push(
|
||||
{
|
||||
name: 'client slim',
|
||||
@@ -125,6 +187,8 @@ export class ForgeGradle3Adapter extends ForgeResolver {
|
||||
)
|
||||
} else {
|
||||
|
||||
// 16+ uses the mcp unified version.
|
||||
|
||||
this.generatedFiles.push(
|
||||
{
|
||||
name: 'client slim',
|
||||
@@ -134,7 +198,8 @@ export class ForgeGradle3Adapter extends ForgeResolver {
|
||||
classifiers: [
|
||||
'slim',
|
||||
'slim-stable'
|
||||
]
|
||||
],
|
||||
classpath: !is117OrGreater
|
||||
},
|
||||
{
|
||||
name: 'client extra',
|
||||
@@ -144,7 +209,8 @@ export class ForgeGradle3Adapter extends ForgeResolver {
|
||||
classifiers: [
|
||||
'extra',
|
||||
'extra-stable'
|
||||
]
|
||||
],
|
||||
classpath: !is117OrGreater
|
||||
}
|
||||
)
|
||||
|
||||
@@ -345,6 +411,7 @@ export class ForgeGradle3Adapter extends ForgeResolver {
|
||||
),
|
||||
name: `Minecraft Forge (${entry.name})`,
|
||||
type: Type.Library,
|
||||
classpath: entry.classpath ?? true,
|
||||
artifact: this.generateArtifact(
|
||||
await readFile(targetLocalPath),
|
||||
await lstat(targetLocalPath),
|
||||
|
||||
@@ -7,6 +7,10 @@ export class LibRepoStructure extends BaseMavenRepo {
|
||||
|
||||
public static readonly FORGE_GROUP = 'net.minecraftforge'
|
||||
public static readonly FORGE_ARTIFACT = 'forge'
|
||||
public static readonly FMLCORE_ARTIFACT = 'fmlcore'
|
||||
public static readonly JAVAFMLLANGUAGE_ARTIFACT = 'javafmllanguage'
|
||||
public static readonly MCLANGUAGE_ARTIFACT = 'mclanguage'
|
||||
public static readonly LOWCODELANGUAGE_ARTIFACT = 'lowcodelanguage'
|
||||
|
||||
constructor(
|
||||
absoluteRoot: string,
|
||||
|
||||
@@ -13,7 +13,7 @@ export class ForgeModStructure113 extends BaseForgeModStructure {
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public static isForVersion(version: MinecraftVersion, libraryVersion: string): boolean {
|
||||
return VersionUtil.isVersionAcceptable(version, [13, 14, 15, 16])
|
||||
return VersionUtil.isVersionAcceptable(version, [13, 14, 15, 16, 17, 18, 19])
|
||||
}
|
||||
|
||||
private forgeModMetadata: {[property: string]: ModsToml | undefined} = {}
|
||||
|
||||
Reference in New Issue
Block a user