From fb7bc0f1031465b2679b294e5f085cb4808cd97d Mon Sep 17 00:00:00 2001 From: Hileb <107909747+Ecdcaeb@users.noreply.github.com> Date: Fri, 3 May 2024 08:00:05 +0800 Subject: [PATCH] importNeoForge --- build.gradle | 37 ++++++++++++------------------------- settings.gradle | 6 +++++- 2 files changed, 17 insertions(+), 26 deletions(-) diff --git a/build.gradle b/build.gradle index d88b258..a7742d0 100644 --- a/build.gradle +++ b/build.gradle @@ -25,14 +25,12 @@ buildscript { } } dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '6.10.+', changing: true + classpath group: 'net.neoforged.gradle.userdev', name: 'NeoGradle', version: '7.0.109', changing: false classpath "org.spongepowered:mixingradle:0.7.+" } } -//if (propertyBool('use_mirror')) apply from: "gradle/scripts/mirror.gradle" - -apply plugin: 'net.minecraftforge.gradle' +apply plugin: 'net.neoforged.gradle.userdev' apply plugin: 'eclipse' apply plugin: 'maven-publish' apply plugin: 'java' @@ -147,7 +145,7 @@ dependencies { // The "userdev" classifier will be requested and setup by ForgeGradle. // If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"], // then special handling is done to allow a setup of a vanilla dependency without the use of an external repository. - minecraft "com.cleanroommc:cleanroom:${project.cleanroom_version}" + implementation "com.cleanroommc:cleanroom:${project.cleanroom_version}" // Example mod dependency with JEI // The JEI API is declared for compile time use, while the full JEI artifact is used at runtime @@ -190,30 +188,12 @@ dependencies { // A missing property will result in an error. Properties are expanded using ${} Groovy notation. // When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments. // See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html -tasks.named('processResources', ProcessResources).configure { +processResources { def filterList = ['mcmod.info', 'pack.mcmeta'] filterList.addAll(propertyStringList('mixin_configs').collect(config -> "mixins.${config}.json" as String)) - - var replaceProperties = [ - mod_id: propertyString('mod_id'), - mod_name: propertyString('mod_name'), - mod_version: propertyString('mod_version'), - mod_description: propertyString('mod_description'), - mod_authors: "[${propertyStringList('mod_authors', ',').join(', ')}]", - mod_credits: propertyString('mod_credits'), - mod_url: propertyString('mod_url'), - mod_update_json: propertyString('mod_update_json'), - mod_logo_path: propertyString('mod_logo_path'), - mixin_refmap: propertyString('mixin_refmap'), - mixin_package: propertyString('mixin_package') - - ] - inputs.properties replaceProperties - filesMatching(filterList) { - expand replaceProperties + [project: project] + expand project.properties } - if (propertyBool('use_access_transformer')) { rename '(.+_at.cfg)', 'META-INF/$1' } @@ -274,6 +254,13 @@ eclipse { // Run when importing the project synchronizationTasks 'genEclipseRuns' } +// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior. +idea { + module { + downloadSources = true + downloadJavadoc = true + } +} // Merge the resources and classes into the same directory. // This is done because java expects modules to be in a single directory. diff --git a/settings.gradle b/settings.gradle index 8c7b6dd..fe0090c 100644 --- a/settings.gradle +++ b/settings.gradle @@ -9,11 +9,15 @@ pluginManagement { name = 'OutLands' url = 'https://maven.outlands.top/releases' } + maven { + name = 'NeoForge' + url = 'https://maven.neoforged.net/releases' + } } } plugins { - id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0' } // Due to an IntelliJ bug, this has to be done