Skip to content

Commit

Permalink
build: Switch to ModDevGradle, bump to 1.21.1
Browse files Browse the repository at this point in the history
  • Loading branch information
BlayTheNinth committed Aug 12, 2024
1 parent 9c86c00 commit fa7d5d3
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 80 deletions.
6 changes: 2 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
plugins {
id 'fabric-loom' version '1.6-SNAPSHOT' apply(false)
// id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT' apply(false) // this causes ForgeGradle to fail in reobf
id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.7" // this is required for VanillaGradle and NeoForge to exist in harmony
id 'org.spongepowered.mixin' version '0.7-SNAPSHOT' apply(false)
id 'fabric-loom' version '1.7-SNAPSHOT' apply(false)
id 'net.neoforged.moddev' version '0.1.110' apply(false)
id 'net.darkhax.curseforgegradle' version '1.1.18' apply(false)
id "com.modrinth.minotaur" version "2.+" apply(false)
}
Expand Down
13 changes: 13 additions & 0 deletions buildSrc/src/main/groovy/multiloader-common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ repositories {
}
}
filter { includeGroupAndSubgroups("org.spongepowered") }
exclusiveContent {
forRepositories(
maven {
name = 'ParchmentMC'
url = 'https://maven.parchmentmc.org/'
},
maven {
name = "NeoForge"
url = 'https://maven.neoforged.net/releases'
}
)
filter { includeGroup('org.parchmentmc.data') }
}
}
maven { url "https://maven.twelveiterations.com/repository/maven-public/" }
}
Expand Down
17 changes: 11 additions & 6 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
plugins {
id 'multiloader-common'
id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT'
id 'net.neoforged.moddev'
}

base {
archivesName = "${mod_id}-common-${minecraft_version}"
}

minecraft {
version(minecraft_version)
def aw = file("src/main/resources/${mod_id}.accesswidener")
if (aw.exists()) {
accessWideners(aw)
neoForge {
neoFormVersion = neo_form_version
// Automatically enable AccessTransformers if the file exists
def at = file('src/main/resources/META-INF/accesstransformer.cfg')
if (at.exists()) {
accessTransformers.add(at.absolutePath)
}
parchment {
minecraftVersion = parchment_minecraft
mappingsVersion = parchment_version
}
}

Expand Down
5 changes: 4 additions & 1 deletion fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ plugins {

dependencies {
minecraft "com.mojang:minecraft:${minecraft_version}"
mappings loom.officialMojangMappings()
mappings loom.layered {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${parchment_minecraft}:${parchment_version}@zip")
}
modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
}
Expand Down
4 changes: 1 addition & 3 deletions forge/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id 'multiloader-loader'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
id 'org.spongepowered.mixin'
id 'org.spongepowered.mixin' version '0.7-SNAPSHOT'
id 'net.darkhax.curseforgegradle'
id "com.modrinth.minotaur"
}
Expand All @@ -24,8 +24,6 @@ minecraft {
copyIdeResources = true

// Automatically enable forge AccessTransformers if the file exists
// This location is hardcoded in Forge and can not be changed.
// https://github.com/MinecraftForge/MinecraftForge/blob/be1698bb1554f9c8fa2f58e32b9ab70bc4385e60/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java#L123
def at = file('src/main/resources/META-INF/accesstransformer.cfg')
if (at.exists()) {
accessTransformer = at
Expand Down
15 changes: 10 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,30 @@ modrinth_release_type = release
modrinth_project_id = MBAkmtvl

# Minecraft
minecraft_version = 1.21
minecraft_versions = 1.21
minecraft_version = 1.21.1
minecraft_versions = 1.21,1.21.1
minecraft_version_range = [1.21,)
pack_format_number = 18
java_version = 21

# NeoForm and Parchment
neo_form_version=1.21.1-20240808.144430
parchment_minecraft=1.21
parchment_version=2024.06.23

# Forge
forge_version = 51.0.0
forge_version = 52.0.2
forge_version_range = [51,)
forge_loader_version_range = [51,)

# NeoForge
neoforge_snapshot_url=
neoforge_version = 21.0.82-beta
neoforge_version = 21.1.8
neoforge_version_range = [21.0.82-beta,)
neoforge_loader_version_range = [1,)

# Fabric
fabric_version = 0.100.1+1.21
fabric_version = 0.102.1+1.21.1
fabric_loader_version = 0.15.11

# Dependencies
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
73 changes: 30 additions & 43 deletions neoforge/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'multiloader-loader'
id 'net.neoforged.gradle.userdev' version '7.0.142'
id 'net.neoforged.moddev'
id 'net.darkhax.curseforgegradle'
id "com.modrinth.minotaur"
}
Expand All @@ -9,51 +9,42 @@ base {
archivesName = "${mod_id}-neoforge-${minecraft_version}"
}

def at = file('src/main/resources/META-INF/accesstransformer.cfg')
if (at.exists()) {
minecraft.accessTransformers.file at
}

runs {
configureEach {
// Recommended logging data for a userdev environment
// The markers can be added/remove as needed separated by commas.
// "SCAN": For mods scan.
// "REGISTRIES": For firing of registry events.
// "REGISTRYDUMP": For getting the contents of all registries.
systemProperty 'forge.logging.markers', 'REGISTRIES'

// Recommended logging level for the console
// You can set various levels here.
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
systemProperty 'forge.logging.console.level', 'debug'

modSource project.sourceSets.main
neoForge {
version = neoforge_version
// Automatically enable neoforge AccessTransformers if the file exists
def at = project(':common').file('src/main/resources/META-INF/accesstransformer.cfg')
if (at.exists()) {
accessTransformers.add(at.absolutePath)
}

client {
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
parchment {
minecraftVersion = parchment_minecraft
mappingsVersion = parchment_version
}

server {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
programArgument '--nogui'
}
runs {
configureEach {
systemProperty('neoforge.enabledGameTestNamespaces', mod_id)
ideName = "NeoForge ${it.name.capitalize()} (${project.path})"
}

// This run config launches GameTestServer and runs all registered gametests, then exits.
// By default, the server will crash when no gametests are provided.
// The gametest system is also enabled by default for other run configs under the /test command.
gameTestServer {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
}
client {
client()
}

data {
// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
// workingDirectory project.file('run-data')
server {
server()
}

// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
data {
data()
}
}

mods {
"${mod_id}" {
sourceSet sourceSets.main
}
}
}

Expand All @@ -71,10 +62,6 @@ repositories {
}
}

dependencies {
implementation "net.neoforged:neoforge:${neoforge_version}"
}

apply from: rootProject.file('repositories.gradle')
apply from: 'dependencies.gradle'

Expand Down
2 changes: 0 additions & 2 deletions neoforge/dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
jarJar.enable()

dependencies {
jarJar(group: "net.blay09.mods", name: "kuma-api-neoforge", version: "$kuma_version")
compileOnly "mezz.jei:jei-$jei_minecraft_version-common-api:$jei_version"
Expand Down
18 changes: 3 additions & 15 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ pluginManagement {
exclusiveContent {
forRepository {
maven {
name = 'NeoForge'
url = uri("https://maven.neoforged.net/releases")
name = 'Sponge'
url = uri('https://repo.spongepowered.org/repository/maven-public')
}
}
filter {
includeGroupAndSubgroups("net.neoforged")
includeGroup("codechicken")
includeGroupAndSubgroups("org.spongepowered")
}
}
exclusiveContent {
Expand All @@ -37,17 +36,6 @@ pluginManagement {
includeGroupAndSubgroups("net.minecraftforge")
}
}
exclusiveContent {
forRepository {
maven {
name = 'Sponge Snapshots'
url = uri("https://repo.spongepowered.org/repository/maven-public")
}
}
filter {
includeGroupAndSubgroups("org.spongepowered")
}
}
}
}

Expand Down

0 comments on commit fa7d5d3

Please sign in to comment.