Skip to content
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
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ plugins {
id 'maven-publish'
}

base {
archivesName = "${mod_id}-${project.name}-${minecraft_version}"
}

java {
toolchain.languageVersion = JavaLanguageVersion.of(java_version)
withSourcesJar()
Expand Down Expand Up @@ -92,7 +88,6 @@ processResources {
publishing {
publications {
register('mavenJava', MavenPublication) {
artifactId base.archivesName.get()
from components.java
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,26 @@ plugins {
id 'multiloader-common'
}

String commonPath = ":$mod_id-common"

configurations {
commonJava{
commonJava {
canBeResolved = true
}
commonResources{
commonResources {
canBeResolved = true
}
}

dependencies {
compileOnly(project(':common')) {
compileOnly(project(commonPath)) {
def loaderAttribute = Attribute.of('io.github.mcgradleconventions.loader', String)
attributes {
attribute(loaderAttribute, 'common')
}
}
commonJava project(path: ':common', configuration: 'commonJava')
commonResources project(path: ':common', configuration: 'commonResources')
commonJava project(path: commonPath, configuration: 'commonJava')
commonResources project(path: commonPath, configuration: 'commonResources')
}

tasks.named('compileJava', JavaCompile) {
Expand Down
5 changes: 4 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ plugins {
id 'net.fabricmc.fabric-loom' version '1.15.5' apply false
// see https://projects.neoforged.net/neoforged/moddevgradle for new versions
id 'net.neoforged.moddev' version '2.0.141' apply false
}
}

group = property("group")
version = property("version")
3 changes: 2 additions & 1 deletion fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ plugins {
id 'multiloader-loader'
id 'net.fabricmc.fabric-loom'
}

dependencies {
minecraft "com.mojang:minecraft:${minecraft_version}"
implementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
implementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
}

loom {
def aw = project(':common').file("src/main/resources/${mod_id}.accesswidener")
def aw = project(":$mod_id-common").file("src/main/resources/${mod_id}.accesswidener")
if (aw.exists()) {
accessWidenerPath.set(aw)
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# Project
version=26.1.2.0
group=com.example.examplemod
group=com.example
java_version=25

# Common
Expand Down
2 changes: 1 addition & 1 deletion neoforge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
neoForge {
version = neoforge_version
// Automatically enable neoforge AccessTransformers if the file exists
def at = project(':common').file('src/main/resources/META-INF/accesstransformer.cfg')
def at = project(":$mod_id-common").file('src/main/resources/META-INF/accesstransformer.cfg')
if (at.exists()) {
accessTransformers.from(at.absolutePath)
}
Expand Down
22 changes: 17 additions & 5 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,20 @@ plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0'
}

// This should match the folder name of the project, or else IDEA may complain (see https://youtrack.jetbrains.com/issue/IDEA-317606)
rootProject.name = 'MultiLoader-Template'
include('common')
include('fabric')
include('neoforge')
String modId = providers.gradleProperty("mod_id").get()

rootProject.name = modId

includeBuild("build-logic")

rootDir.listFiles().findAll {
it.isDirectory()
&& it.name != "build-logic"
&& (new File(it, "build.gradle").exists() || new File(it, "build.gradle.kts").exists())
}.forEach {
String relativePath = rootDir.toPath().relativize(it.toPath()).toString()
String projectName = ":$modId-$relativePath"

include(projectName)
project(projectName).projectDir = it
}