almostunified/Fabric/build.gradle.kts

67 lines
2.4 KiB
Text
Raw Permalink Normal View History

2022-05-31 10:50:46 -04:00
val minecraftVersion: String by project
val fabricLoaderVersion: String by project
2023-02-01 14:43:30 -05:00
val fabricApiVersion: String by project
val fabricRecipeViewer: String by project
val enableRuntimeRecipeViewer: String by project
2022-09-16 14:13:01 -04:00
val jeiVersion: String by project
2023-07-28 18:59:02 -04:00
val reiVersion: String by project
val emiVersion: String by project
val common by configurations
val shadowCommon by configurations
2022-05-31 10:50:46 -04:00
plugins {
2023-08-05 18:36:18 -04:00
id("com.github.johnrengelman.shadow") version "8.1.1"
2022-05-31 10:50:46 -04:00
}
2023-02-01 14:43:30 -05:00
architectury {
platformSetupLoomIde()
fabric()
2022-05-31 10:50:46 -04:00
}
loom {
2023-07-28 18:59:02 -04:00
if (project.findProperty("enableAccessWidener") == "true") { // optional property for `gradle.properties`
2023-02-01 14:43:30 -05:00
accessWidenerPath.set(project(":Common").loom.accessWidenerPath)
println("Access widener enabled for project ${project.name}. Access widener path: ${loom.accessWidenerPath.get()}")
}
}
dependencies {
2023-06-14 05:48:49 -04:00
// loader
modImplementation("net.fabricmc:fabric-loader:$fabricLoaderVersion")
2023-02-01 14:43:30 -05:00
modApi("net.fabricmc.fabric-api:fabric-api:$fabricApiVersion+$minecraftVersion")
2023-06-14 05:48:49 -04:00
// common module
2023-02-01 14:43:30 -05:00
common(project(":Common", "namedElements")) { isTransitive = false }
shadowCommon(project(":Common", "transformProductionFabric")) { isTransitive = false }
testImplementation(project(":Common", "namedElements"))
// compile time
2023-07-28 19:43:23 -04:00
modCompileOnly("mezz.jei:jei-$minecraftVersion-fabric-api:$jeiVersion") // required for common jei plugin
modCompileOnly("me.shedaniel:RoughlyEnoughItems-api-fabric:$reiVersion") // required for common rei plugin
modCompileOnly("dev.emi:emi-fabric:$emiVersion+$minecraftVersion:api") // required for common emi plugin
2023-06-14 05:48:49 -04:00
// runtime
if (enableRuntimeRecipeViewer == "true") {
modLocalRuntime(
when (fabricRecipeViewer) {
"jei" -> "mezz.jei:jei-$minecraftVersion-fabric:$jeiVersion"
"rei" -> "me.shedaniel:RoughlyEnoughItems-fabric:$reiVersion"
"emi" -> "dev.emi:emi-fabric:$emiVersion+$minecraftVersion"
else -> throw GradleException("Invalid fabricRecipeViewer value: $fabricRecipeViewer")
}
)
}
2023-08-05 18:36:18 -04:00
}
/**
* force the fabric loader and api versions that are defined in the project
* some mods ship another version which crashes the runtime
*/
configurations.all {
resolutionStrategy {
force("net.fabricmc:fabric-loader:$fabricLoaderVersion")
force("net.fabricmc.fabric-api:fabric-api:$fabricApiVersion+$minecraftVersion")
}
2022-05-31 10:50:46 -04:00
}