2022-02-03 19:29:14 +00:00
|
|
|
import org.gradle.kotlin.dsl.accessors.runtime.extensionOf
|
|
|
|
import org.quiltmc.quiltmappings.loom.QuiltMappingsOnLoomPlugin
|
|
|
|
|
2022-02-03 12:46:36 +00:00
|
|
|
plugins {
|
|
|
|
id("fabric-loom")
|
|
|
|
val kotlinVersion: String by System.getProperties()
|
|
|
|
kotlin("jvm").version(kotlinVersion)
|
2022-02-03 19:29:14 +00:00
|
|
|
id("org.quiltmc.quilt-mappings-on-loom").version("3.1.1")
|
2022-02-03 12:46:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
base {
|
|
|
|
val archivesBaseName: String by project
|
|
|
|
archivesName.set(archivesBaseName)
|
|
|
|
}
|
|
|
|
|
|
|
|
val modVersion: String by project
|
|
|
|
version = modVersion
|
|
|
|
val mavenGroup: String by project
|
|
|
|
group = mavenGroup
|
|
|
|
|
|
|
|
minecraft {}
|
|
|
|
|
|
|
|
repositories {}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
val minecraftVersion: String by project
|
|
|
|
minecraft("com.mojang:minecraft:$minecraftVersion")
|
2022-02-03 19:29:14 +00:00
|
|
|
|
|
|
|
val USE_QUILT_MAPPINGS = false
|
|
|
|
if (USE_QUILT_MAPPINGS) {
|
|
|
|
// Seems to crash on startup right now
|
|
|
|
|
|
|
|
val quiltMappings: String by project
|
|
|
|
mappings(loom.layered {
|
|
|
|
officialMojangMappings {
|
|
|
|
nameSyntheticMembers = false
|
|
|
|
}
|
|
|
|
|
|
|
|
val qm = extensionOf(project, "quiltMappings") as QuiltMappingsOnLoomPlugin.QuiltMappingsOnLoomExtension
|
|
|
|
addLayer(qm.mappings("org.quiltmc:quilt-mappings:${quiltMappings}:v2"))
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
val yarnMappings: String by project
|
|
|
|
mappings("net.fabricmc:yarn:$yarnMappings:v2")
|
|
|
|
}
|
|
|
|
|
2022-02-03 12:46:36 +00:00
|
|
|
val loaderVersion: String by project
|
|
|
|
modImplementation("net.fabricmc:fabric-loader:$loaderVersion")
|
|
|
|
val fabricVersion: String by project
|
|
|
|
modImplementation("net.fabricmc.fabric-api:fabric-api:$fabricVersion")
|
|
|
|
val fabricKotlinVersion: String by project
|
|
|
|
modImplementation("net.fabricmc:fabric-language-kotlin:$fabricKotlinVersion")
|
|
|
|
|
|
|
|
val imguiVersion = "1.86.2"
|
|
|
|
implementation("io.github.spair:imgui-java-binding:$imguiVersion")
|
|
|
|
implementation("io.github.spair:imgui-java-lwjgl3:$imguiVersion") {
|
|
|
|
exclude(group = "org.lwjgl")
|
|
|
|
}
|
|
|
|
implementation("io.github.spair:imgui-java-natives-windows-ft:$imguiVersion")
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks {
|
|
|
|
val javaVersion = JavaVersion.VERSION_17
|
|
|
|
|
|
|
|
withType<JavaCompile> {
|
|
|
|
options.encoding = "UTF-8"
|
|
|
|
sourceCompatibility = javaVersion.toString()
|
|
|
|
targetCompatibility = javaVersion.toString()
|
|
|
|
options.release.set(javaVersion.toString().toInt())
|
|
|
|
}
|
|
|
|
|
|
|
|
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
2022-02-03 19:29:14 +00:00
|
|
|
kotlinOptions {
|
|
|
|
jvmTarget = javaVersion.toString()
|
|
|
|
freeCompilerArgs = freeCompilerArgs + listOf("-Xopt-in=kotlin.RequiresOptIn")
|
|
|
|
}
|
|
|
|
|
2022-02-03 12:46:36 +00:00
|
|
|
sourceCompatibility = javaVersion.toString()
|
|
|
|
targetCompatibility = javaVersion.toString()
|
|
|
|
}
|
|
|
|
|
|
|
|
jar { from("LICENSE") { rename { "${it}_${base.archivesName}" } } }
|
|
|
|
|
|
|
|
processResources {
|
|
|
|
inputs.property("version", project.version)
|
|
|
|
filesMatching("fabric.mod.json") { expand(mutableMapOf("version" to project.version)) }
|
|
|
|
}
|
|
|
|
|
|
|
|
java {
|
|
|
|
toolchain { languageVersion.set(JavaLanguageVersion.of(javaVersion.toString())) }
|
|
|
|
sourceCompatibility = javaVersion
|
|
|
|
targetCompatibility = javaVersion
|
|
|
|
withSourcesJar()
|
|
|
|
}
|
|
|
|
}
|