From 0cc8f8710b054fb8d47d19979457b2b8f763247e Mon Sep 17 00:00:00 2001 From: BlayTheNinth <1933180+BlayTheNinth@users.noreply.github.com> Date: Sat, 11 Nov 2023 10:23:40 +0100 Subject: [PATCH] Apply MultiLoader Template's latest changes, though the same import issue still occurs. Noteworthy, a fresh clone of MultiLoader template doesn't have the issue, so need to go through and make sure we match --- gradle.properties | 4 ++-- neoforge/build.gradle | 29 ++++++++++++++++++++++------- neoforge/dependencies.gradle | 4 ++++ settings.gradle | 9 ++++++++- 4 files changed, 36 insertions(+), 10 deletions(-) diff --git a/gradle.properties b/gradle.properties index 9566d3c9..d783a3c5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,12 +19,12 @@ java_version = 17 # Forge forge_version = 48.0.1 -forge_version_range=[48.0.0,) +forge_version_range=[48,) forge_loader_version_range=[48,) forge_mixins=true # NeoForge -neoforge_version = 20.2.8-beta +neoforge_version = 20.2.47-beta neoforge_version_range=[20.2,) neoforge_loader_version_range=[1,) mapping_channel=official diff --git a/neoforge/build.gradle b/neoforge/build.gradle index c1de2bc0..8b261f7b 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -2,7 +2,7 @@ plugins { id 'java-library' id 'idea' id 'maven-publish' - id 'net.neoforged.gradle.userdev' version '7.0.5' + id 'net.neoforged.gradle.userdev' version '7.0.41' id 'net.darkhax.curseforgegradle' version '1.0.14' id "com.modrinth.minotaur" version "2.+" } @@ -20,6 +20,9 @@ base { java.toolchain.languageVersion = JavaLanguageVersion.of(17) +if (file('src/main/resources/META-INF/accesstransformer.cfg').exists()) { + minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg') +} runs { configureEach { // Recommended logging data for a userdev environment @@ -70,19 +73,31 @@ dependencies { compileOnly project(":shared") compileOnly "org.jetbrains:annotations:22.0.0" - - compileOnly "mezz.jei:jei-$jei_minecraft_version-common-api:$jei_version" - if (jei_minecraft_version == minecraft_version) { - runtimeOnly "mezz.jei:jei-$jei_minecraft_version-forge:$jei_version" - } } apply from: 'dependencies.gradle' -tasks.withType(JavaCompile) { +// NeoGradle compiles the game, but we don't want to add our common code to the game's code +TaskCollection.metaClass.excludingNeoTasks = { -> + delegate.matching { !it.name.startsWith("neo") } +} + +tasks.withType(JavaCompile).excludingNeoTasks().configureEach { source(project(":shared").sourceSets.main.allSource) } +tasks.withType(Javadoc).excludingNeoTasks().configureEach { + source(project(":shared").sourceSets.main.allJava) +} + +tasks.named("sourcesJar", Jar) { + from(project(":shared").sourceSets.main.allSource) +} + +tasks.withType(ProcessResources).excludingNeoTasks().configureEach { + from project(":shared").sourceSets.main.resources +} + def resourceTargets = ['META-INF/mods.toml', 'pack.mcmeta'] def replaceProperties = [ minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range, diff --git a/neoforge/dependencies.gradle b/neoforge/dependencies.gradle index 571b4175..21cc177b 100644 --- a/neoforge/dependencies.gradle +++ b/neoforge/dependencies.gradle @@ -1,2 +1,6 @@ dependencies { + compileOnly "mezz.jei:jei-$jei_minecraft_version-common-api:$jei_version" + if (jei_minecraft_version == minecraft_version) { + runtimeOnly "mezz.jei:jei-$jei_minecraft_version-forge:$jei_version" + } } \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 1c3e1fa8..e7d4457e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,11 +1,18 @@ pluginManagement { repositories { gradlePluginPortal() - maven { url = 'https://maven.neoforged.net/releases' } maven { name = 'Fabric' url = 'https://maven.fabricmc.net/' } + maven { + name = 'NeoForge' + url = 'https://maven.neoforged.net/releases/' + } + maven { + name = 'Forge' + url = 'https://maven.minecraftforge.net/' + } maven { name = 'Sponge Snapshots' url = 'https://repo.spongepowered.org/repository/maven-public/'