From 7c474f872c2474f39c0bfcdd4861d697c134d85f Mon Sep 17 00:00:00 2001 From: JackCarterSmith Date: Sat, 9 Mar 2024 15:29:41 +0100 Subject: [PATCH] Migrate to ForgeGradle-4.x --- build.gradle | 25 +++++++++++++++++++++--- gradle/wrapper/gradle-wrapper.properties | 3 ++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 7157aaf..f8aa352 100644 --- a/build.gradle +++ b/build.gradle @@ -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) { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 949819d..bf2b659 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -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