2022-09-24 14:05:47 -04:00
|
|
|
@file:Suppress("UnstableApiUsage")
|
2022-05-31 10:50:46 -04:00
|
|
|
|
2022-10-17 14:57:09 -04:00
|
|
|
val modId: String by project
|
|
|
|
val modName: String by project
|
2022-09-24 14:05:47 -04:00
|
|
|
val extraModsDirectory: String by project
|
|
|
|
val fabricRecipeViewer: String by project
|
2022-05-31 10:50:46 -04:00
|
|
|
val minecraftVersion: String by project
|
|
|
|
val fabricVersion: String by project
|
|
|
|
val fabricLoaderVersion: String by project
|
2022-05-31 17:19:29 -04:00
|
|
|
val reiVersion: String by project
|
2022-09-16 14:13:01 -04:00
|
|
|
val jeiVersion: String by project
|
2022-09-24 14:05:47 -04:00
|
|
|
val kubejsVersion: String by project
|
|
|
|
val mappingsChannel: String by project
|
|
|
|
val mappingsVersion: String by project
|
2022-05-31 10:50:46 -04:00
|
|
|
|
2022-10-17 14:57:09 -04:00
|
|
|
val baseArchiveName = "$modId-fabric"
|
2022-05-31 10:50:46 -04:00
|
|
|
|
2022-09-24 14:05:47 -04:00
|
|
|
plugins {
|
|
|
|
id("fabric-loom") version "0.12-SNAPSHOT"
|
2022-05-31 10:50:46 -04:00
|
|
|
}
|
|
|
|
|
2022-09-24 14:05:47 -04:00
|
|
|
base {
|
|
|
|
archivesName.set(baseArchiveName)
|
2022-05-31 10:50:46 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
loom {
|
|
|
|
runs {
|
|
|
|
named("client") {
|
|
|
|
client()
|
|
|
|
configName = "Fabric Client"
|
|
|
|
ideConfigGenerated(true)
|
|
|
|
runDir("run")
|
2022-09-06 12:00:22 -04:00
|
|
|
vmArgs("-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AllowEnhancedClassRedefinition")
|
2022-05-31 10:50:46 -04:00
|
|
|
}
|
|
|
|
named("server") {
|
|
|
|
server()
|
|
|
|
configName = "Fabric Server"
|
|
|
|
ideConfigGenerated(true)
|
|
|
|
runDir("run")
|
2022-09-06 12:00:22 -04:00
|
|
|
vmArgs("-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AllowEnhancedClassRedefinition")
|
2022-05-31 10:50:46 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-15 09:54:03 -04:00
|
|
|
mixin {
|
2022-09-24 14:05:47 -04:00
|
|
|
defaultRefmapName.set("$modId.refmap.json")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2022-09-27 12:10:51 -04:00
|
|
|
compileOnly(project(":Common", "namedElements")) { isTransitive = false }
|
2022-09-24 14:05:47 -04:00
|
|
|
|
2022-10-17 14:57:09 -04:00
|
|
|
compileOnly("com.google.auto.service:auto-service:1.0.1")
|
|
|
|
annotationProcessor("com.google.auto.service:auto-service:1.0.1")
|
|
|
|
|
2022-09-24 14:05:47 -04:00
|
|
|
minecraft("com.mojang:minecraft:$minecraftVersion")
|
|
|
|
modImplementation("net.fabricmc:fabric-loader:$fabricLoaderVersion")
|
|
|
|
modImplementation("net.fabricmc.fabric-api:fabric-api:$fabricVersion")
|
|
|
|
mappings(loom.layered {
|
|
|
|
officialMojangMappings()
|
2022-10-17 14:57:09 -04:00
|
|
|
parchment("org.parchmentmc.data:$mappingsChannel-$minecraftVersion:$mappingsVersion@zip")
|
2022-09-24 14:05:47 -04:00
|
|
|
})
|
|
|
|
|
2022-09-27 12:10:51 -04:00
|
|
|
modCompileOnly("me.shedaniel:RoughlyEnoughItems-api-fabric:$reiVersion") // required for common rei plugin
|
2022-11-30 14:49:18 -05:00
|
|
|
compileOnly("me.shedaniel:REIPluginCompatibilities-forge-annotations:9.+") // required to disable rei compat layer on jei plugin
|
|
|
|
testCompileOnly("me.shedaniel:REIPluginCompatibilities-forge-annotations:9.+") // don't question this, it's required for compiling
|
2022-09-24 14:05:47 -04:00
|
|
|
modCompileOnly("mezz.jei:jei-$minecraftVersion-fabric:$jeiVersion") // required for common jei plugin and mixin
|
2022-10-17 14:57:09 -04:00
|
|
|
|
2022-09-24 14:05:47 -04:00
|
|
|
// runtime only
|
|
|
|
when (fabricRecipeViewer) {
|
|
|
|
"rei" -> modLocalRuntime("me.shedaniel:RoughlyEnoughItems-fabric:$reiVersion")
|
|
|
|
"jei" -> modLocalRuntime("mezz.jei:jei-$minecraftVersion-fabric:$jeiVersion")
|
|
|
|
else -> throw GradleException("Invalid fabricRecipeViewer value: $fabricRecipeViewer")
|
|
|
|
}
|
|
|
|
|
|
|
|
// required for common kubejs plugin and fabric runtime
|
|
|
|
modCompileOnly(modLocalRuntime("dev.latvian.mods:kubejs-fabric:$kubejsVersion")!!)
|
|
|
|
|
|
|
|
val extraMods = fileTree("$extraModsDirectory-$minecraftVersion") { include("**/*.jar") }
|
|
|
|
if (extraMods.files.isNotEmpty()) {
|
|
|
|
// required when running the fabric client with extra mods
|
|
|
|
modLocalRuntime("teamreborn:energy:2.2.0")
|
|
|
|
}
|
|
|
|
extraMods.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")
|
|
|
|
modLocalRuntime("$extraModsDirectory:$mod:$version")
|
2022-06-15 09:54:03 -04:00
|
|
|
}
|
|
|
|
}
|
2022-05-31 10:50:46 -04:00
|
|
|
|
2022-09-06 12:00:29 -04:00
|
|
|
tasks {
|
|
|
|
processResources {
|
|
|
|
from(project(":Common").sourceSets.main.get().resources)
|
2022-05-31 10:50:46 -04:00
|
|
|
}
|
2022-09-24 14:05:47 -04:00
|
|
|
withType<JavaCompile> {
|
|
|
|
source(project(":Common").sourceSets.main.get().allSource)
|
|
|
|
}
|
2022-05-31 10:50:46 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
register("mavenJava", MavenPublication::class) {
|
|
|
|
artifactId = baseArchiveName
|
|
|
|
from(components["java"])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
maven("file://${System.getenv("local_maven")}")
|
|
|
|
}
|
|
|
|
}
|