Incendium addon
1plugins {
2 id("fabric-loom") version "1.7-SNAPSHOT"
3 id("maven-publish")
4}
5
6
7class ModData {
8 val id = property("mod.id").toString()
9 val name = property("mod.name").toString()
10 val version = property("mod.version").toString()
11 val group = property("mod.group").toString()
12}
13
14class ModDeps {
15 operator fun get(name: String) = property("deps.$name").toString()
16}
17
18val mod = ModData()
19val deps = ModDeps()
20val mcVersion = stonecutter.current.version
21
22version = "${mod.version}+$mcVersion"
23group = mod.group
24base { archivesName.set(mod.id) }
25
26loom {
27 splitEnvironmentSourceSets()
28
29 mods {
30 create("template") {
31 sourceSet(sourceSets["main"])
32 sourceSet(sourceSets["client"])
33 }
34 }
35}
36
37repositories {
38 mavenCentral()
39}
40
41dependencies {
42 fun fapi(vararg modules: String) {
43 modules.forEach { fabricApi.module(it, deps["fapi"]) }
44 }
45
46 minecraft("com.mojang:minecraft:${deps["minecraft_run"]}")
47 mappings("net.fabricmc:yarn:${deps["yarn_mappings"]}:v2")
48 modImplementation("net.fabricmc:fabric-loader:${deps["fabric_loader"]}")
49 modImplementation("net.fabricmc.fabric-api:fabric-api:${deps["fabric_api"]}")
50 vineflowerDecompilerClasspath("org.vineflower:vineflower:1.10.1")
51
52}
53
54java {
55 withSourcesJar()
56 val java = if (stonecutter.compare(mcVersion, "1.20.6") >= 0) JavaVersion.VERSION_21 else JavaVersion.VERSION_17
57 targetCompatibility = java
58 sourceCompatibility = java
59}
60
61tasks.processResources {
62 inputs.property("id", mod.id)
63 inputs.property("name", mod.name)
64 inputs.property("version", mod.version)
65 inputs.property("minecraft", deps["minecraft"])
66 inputs.property("incendium", deps["incendium"])
67
68 val map = mapOf(
69 "id" to mod.id,
70 "name" to mod.name,
71 "version" to mod.version,
72 "minecraft" to deps["minecraft"],
73 "incendium" to deps["incendium"],
74 )
75
76 filesMatching("fabric.mod.json") { expand(map) }
77}
78
79tasks.register<Copy>("buildAndCollect") {
80 group = "build"
81 from(tasks.remapJar.get().archiveFile)
82 into(rootProject.layout.buildDirectory.file("libs/${mod.version}"))
83 dependsOn("build")
84}
85
86if (stonecutter.current.isActive) {
87 rootProject.tasks.register("buildActive") {
88 group = "project"
89 dependsOn(tasks.named("build"))
90 }
91}