Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new ModDevGradle plugin #762

Open
wants to merge 2 commits into
base: 1.21.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 24 additions & 19 deletions NeoForge/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id 'java-library'
id 'idea'
id 'net.neoforged.gradle.userdev'
id 'net.neoforged.moddev'
id 'eclipse'
}

Expand All @@ -20,24 +20,33 @@ repositories {
}
}

runs {
configureEach {
workingDirectory project.file('../run')
systemProperty 'forge.logging.console.level', 'debug'
systemProperty 'fml.earlyprogresswindow', 'false'
neoForge {
version = "21.0.143"

modSource project.sourceSets.main
mods {
patchouli {
sourceSet sourceSets.main
}
}

client {
}
server {
programArgument '--nogui'
runs {
configureEach {
gameDirectory = project.file('../run')
systemProperty 'forge.logging.console.level', 'debug'
systemProperty 'fml.earlyprogresswindow', 'false'
}

client {
client()
}
server {
server()
programArgument '--nogui'
}
}
}

dependencies {
implementation "net.neoforged:neoforge:21.0.143"
implementation project(":Xplat")

compileOnly "mezz.jei:jei-1.21-common-api:19.5.0.33"
Expand All @@ -49,23 +58,19 @@ tasks.named('test').configure {
enabled(false)
}

TaskCollection.metaClass.excludingNeoTasks = { ->
delegate.matching { !it.name.startsWith("neo") }
}

tasks.withType(JavaCompile).excludingNeoTasks().configureEach {
tasks.withType(JavaCompile).configureEach {
source(project(":Xplat").sourceSets.main.allSource)
}

tasks.withType(Javadoc).excludingNeoTasks().configureEach {
tasks.withType(Javadoc).configureEach {
source(project(":Xplat").sourceSets.main.allJava)
}

tasks.named("sourcesJar", Jar) {
from(project(":Xplat").sourceSets.main.allSource)
}

tasks.withType(ProcessResources).excludingNeoTasks().configureEach {
tasks.withType(ProcessResources).configureEach {
from project(":Xplat").sourceSets.main.resources
}

Expand Down
9 changes: 6 additions & 3 deletions Xplat/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id 'org.spongepowered.gradle.vanilla'
id 'net.neoforged.moddev'
}

base {
Expand All @@ -11,8 +11,11 @@ if (System.getenv().RELEASE_MODE == null) {
version += '-SNAPSHOT'
}

minecraft {
version(mc_version)
neoForge {
// To find the timestamp, see https://projects.neoforged.net/neoforged/neoform
neoFormVersion = "$mc_version-20240613.152323"

addModdingDependenciesTo sourceSets.test
}

repositories {
Expand Down
4 changes: 1 addition & 3 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
pluginManagement {
plugins {
id 'net.neoforged.gradle.userdev' version '7.0.150' apply false
id 'org.spongepowered.mixin' version '0.7-SNAPSHOT' apply false
id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT' apply false
id 'net.neoforged.moddev' version '2.0.26-beta' apply false
id 'fabric-loom' version '1.7-SNAPSHOT' apply false
}
repositories {
Expand Down