1
0

Migrate to ForgeGradle-4.x

This commit is contained in:
JackCarterSmith 2024-03-09 15:29:41 +01:00
parent 30f63e794e
commit 7c474f872c
Signed by: JackCarterSmith
GPG Key ID: 832E52F4E23F8F24
2 changed files with 24 additions and 4 deletions

View File

@ -1,10 +1,10 @@
buildscript {
repositories {
maven { url = 'https://maven.minecraftforge.net/' }
mavenCentral()
maven { url = "https://maven.minecraftforge.net/" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:3.+'
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '4.1.+', changing: true
}
}
@ -18,6 +18,9 @@ group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming
archivesBaseName = 'modid'
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}
minecraft {
// The mappings can be changed at any time, and must be in the following format.
@ -26,7 +29,7 @@ minecraft {
// Use non-default mappings at your own risk. they may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
//mappings channel: 'snapshot', version: '20171003-1.12'
mappings channel: 'snapshot', version: '20171003-1.12'
mappings channel: 'stable', version: '39-1.12'
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
@ -45,6 +48,7 @@ minecraft {
}
server {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
@ -55,6 +59,9 @@ minecraft {
}
}
// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }
dependencies {
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
@ -102,6 +109,18 @@ jar.finalizedBy('reobfJar')
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
//publish.dependsOn('reobfJar')
// workaround for userdev bug
tasks.create("copyResourceToClasses", Copy.class) {
tasks.classes.dependsOn(it)
dependsOn(tasks.processResources)
onlyIf { gradle.taskGraph.hasTask(tasks.prepareRuns) }
into("$buildDir/classes/java/main")
// if you write @Mod class in kotlin, please use code below
// into("$buildDir/classes/kotlin/main")
from(tasks.processResources.destinationDir)
}
publishing {
publications {
mavenJava(MavenPublication) {

View File

@ -1,5 +1,6 @@
#Mon Sep 14 12:28:28 PDT 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-bin.zip