2022-05-31 10:50:46 -04:00
|
|
|
plugins {
|
|
|
|
java
|
|
|
|
eclipse
|
2022-08-21 13:47:06 -04:00
|
|
|
`maven-publish`
|
2022-05-31 10:50:46 -04:00
|
|
|
id("net.minecraftforge.gradle") version ("5.1.+")
|
2022-05-31 12:41:30 -04:00
|
|
|
id("org.parchmentmc.librarian.forgegradle") version ("1.+")
|
2022-08-21 13:47:06 -04:00
|
|
|
id("org.spongepowered.mixin") version ("0.7.+")
|
2022-05-31 10:50:46 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
val minecraftVersion: String by project
|
|
|
|
val mixinVersion: String by project
|
|
|
|
val forgeVersion: String by project
|
|
|
|
val modId: String by project
|
2022-05-31 12:41:30 -04:00
|
|
|
val mappingsChannel: String by project
|
|
|
|
val mappingsVersion: String by project
|
2022-08-21 13:47:06 -04:00
|
|
|
val extraModsDirectory: String by project
|
2022-05-31 17:19:29 -04:00
|
|
|
val jeiVersion: String by project
|
2022-05-31 10:50:46 -04:00
|
|
|
|
2022-08-21 07:41:39 -04:00
|
|
|
val baseArchiveName = "${modId}-forge-${minecraftVersion}"
|
2022-05-31 10:50:46 -04:00
|
|
|
|
|
|
|
base {
|
|
|
|
archivesName.set(baseArchiveName)
|
|
|
|
}
|
|
|
|
|
|
|
|
minecraft {
|
2022-08-23 09:28:26 -04:00
|
|
|
// TODO: change this when updating to 1.19.2
|
|
|
|
mappings(mappingsChannel, "1.18.2-${mappingsVersion}-${minecraftVersion}")
|
2022-05-31 10:50:46 -04:00
|
|
|
|
|
|
|
runs {
|
|
|
|
create("client") {
|
|
|
|
workingDirectory(project.file("run"))
|
|
|
|
ideaModule("${rootProject.name}.${project.name}.main")
|
|
|
|
taskName("Client")
|
|
|
|
property("mixin.env.remapRefMap", "true")
|
|
|
|
property("mixin.env.refMapRemappingFile", "${projectDir}/build/createSrgToMcp/output.srg")
|
2022-09-06 12:00:22 -04:00
|
|
|
jvmArg("-XX:+IgnoreUnrecognizedVMOptions")
|
|
|
|
jvmArg("-XX:+AllowEnhancedClassRedefinition")
|
2022-05-31 10:50:46 -04:00
|
|
|
mods {
|
|
|
|
create(modId) {
|
|
|
|
source(sourceSets.main.get())
|
|
|
|
source(project(":Common").sourceSets.main.get())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
create("server") {
|
|
|
|
workingDirectory(project.file("run"))
|
|
|
|
ideaModule("${rootProject.name}.${project.name}.main")
|
|
|
|
taskName("Server")
|
|
|
|
property("mixin.env.remapRefMap", "true")
|
|
|
|
property("mixin.env.refMapRemappingFile", "${projectDir}/build/createSrgToMcp/output.srg")
|
2022-09-06 12:00:22 -04:00
|
|
|
jvmArg("-XX:+IgnoreUnrecognizedVMOptions")
|
|
|
|
jvmArg("-XX:+AllowEnhancedClassRedefinition")
|
2022-05-31 10:50:46 -04:00
|
|
|
mods {
|
|
|
|
create(modId) {
|
|
|
|
source(sourceSets.main.get())
|
|
|
|
source(project(":Common").sourceSets.main.get())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sourceSets.main.get().resources.srcDir("src/generated/resources")
|
|
|
|
|
2022-06-23 12:47:03 -04:00
|
|
|
// from millions of solutions, this is the only one which works... :-)
|
|
|
|
val commonTests: SourceSetOutput = project(":Common").sourceSets["test"].output
|
|
|
|
|
2022-05-31 10:50:46 -04:00
|
|
|
dependencies {
|
|
|
|
minecraft("net.minecraftforge:forge:${minecraftVersion}-${forgeVersion}")
|
|
|
|
compileOnly(project(":Common"))
|
|
|
|
|
2022-08-18 17:21:42 -04:00
|
|
|
compileOnly(fg.deobf("mezz.jei:jei-${minecraftVersion}-common-api:${jeiVersion}"))
|
|
|
|
compileOnly(fg.deobf("mezz.jei:jei-${minecraftVersion}-forge-api:${jeiVersion}"))
|
|
|
|
runtimeOnly(fg.deobf("mezz.jei:jei-${minecraftVersion}-forge:${jeiVersion}"))
|
2022-07-29 16:45:44 -04:00
|
|
|
|
2022-08-21 13:47:06 -04:00
|
|
|
fileTree("$extraModsDirectory-$minecraftVersion") { include("**/*.jar") }
|
2022-07-29 16:45:44 -04:00
|
|
|
.forEach { f ->
|
|
|
|
val sepIndex = f.nameWithoutExtension.lastIndexOf('-');
|
|
|
|
if(sepIndex == -1) {
|
|
|
|
throw IllegalArgumentException("Invalid mod name: ${f.nameWithoutExtension}")
|
|
|
|
}
|
|
|
|
val mod = f.nameWithoutExtension.substring(0, sepIndex);
|
|
|
|
val version = f.nameWithoutExtension.substring(sepIndex + 1);
|
|
|
|
println("Extra mod $mod with version $version detected")
|
2022-08-21 13:47:06 -04:00
|
|
|
runtimeOnly(fg.deobf("$extraModsDirectory:$mod:$version"))
|
2022-07-29 16:45:44 -04:00
|
|
|
}
|
2022-05-31 17:19:29 -04:00
|
|
|
|
2022-05-31 10:50:46 -04:00
|
|
|
annotationProcessor("org.spongepowered:mixin:${mixinVersion}:processor")
|
2022-06-23 12:47:03 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Test dependencies
|
|
|
|
*/
|
|
|
|
testImplementation(project(":Common"))
|
|
|
|
testImplementation(commonTests)
|
2022-07-29 16:45:44 -04:00
|
|
|
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.1")
|
|
|
|
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.1")
|
2022-05-31 10:50:46 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
mixin {
|
|
|
|
add(sourceSets.main.get(), "${modId}.refmap.json")
|
|
|
|
config("${modId}-common.mixins.json")
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks {
|
|
|
|
jar {
|
|
|
|
finalizedBy("reobfJar")
|
|
|
|
}
|
2022-09-06 12:00:29 -04:00
|
|
|
withType<JavaCompile> {
|
|
|
|
source(project(":Common").sourceSets.main.get().allSource)
|
|
|
|
}
|
|
|
|
withType<Test> {
|
|
|
|
useJUnitPlatform()
|
|
|
|
}
|
|
|
|
processResources {
|
|
|
|
from(project(":Common").sourceSets.main.get().resources)
|
|
|
|
}
|
2022-06-23 12:47:03 -04:00
|
|
|
}
|
|
|
|
|
2022-05-31 10:50:46 -04:00
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
register("mavenJava", MavenPublication::class) {
|
|
|
|
artifactId = baseArchiveName
|
|
|
|
artifact(tasks.jar)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
maven("file://${System.getenv("local_maven")}")
|
|
|
|
}
|
|
|
|
}
|