forked from Skidamek/AutoModpack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.fabric.gradle.kts
More file actions
82 lines (70 loc) · 2.86 KB
/
build.fabric.gradle.kts
File metadata and controls
82 lines (70 loc) · 2.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
@file:Suppress("UnstableApiUsage")
plugins {
kotlin("jvm")
id("automodpack.common")
id("fabric-loom")
}
version = "${property("mod_version")}"
group = "${property("mod.group")}"
base.archivesName.set("${property("mod_name")}-mc${property("deps.minecraft")}-fabric".lowercase())
loom {
accessWidenerPath = rootProject.file("src/main/resources/automodpack.accesswidener")
}
dependencies {
implementation(project(":core"))
implementation(project(":loader-core"))
minecraft("com.mojang:minecraft:${property("deps.minecraft")}")
mappings(loom.layered {
officialMojangMappings()
if (hasProperty("deps.parchment"))
parchment("org.parchmentmc.data:parchment-${property("deps.parchment")}@zip")
})
modImplementation("net.fabricmc:fabric-loader:${property("deps.fabric-loader")}")
setOf(
"api-base", // Required by modules below
"registry-sync-v0", // Required for custom sounds
"networking-api-v1", // Required by registry sync module
"resource-loader-v0" // Required for translatable texts
).forEach {
include(modImplementation(fabricApi.module("fabric-$it", property("deps.fabric-api") as String))!!)
}
// Required for commands
if (stonecutter.eval(stonecutter.current.version, "<1.19.2")) {
include(modImplementation(fabricApi.module("fabric-command-api-v1", property("deps.fabric-api") as String))!!)
} else {
include(modImplementation(fabricApi.module("fabric-command-api-v2", property("deps.fabric-api") as String))!!)
}
// Required for translatable texts in 1.21.9+ for some reason i need both v0 and v1?
if (stonecutter.eval(stonecutter.current.version, ">=1.21.9")) {
include(modImplementation(fabricApi.module("fabric-resource-loader-v1", property("deps.fabric-api") as String))!!)
}
}
java {
if (stonecutter.eval(stonecutter.current.version, ">=1.20.5")) {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
} else {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}
withSourcesJar()
}
tasks {
processResources {
exclude("**/neoforge.mods.toml", "**/mods.toml", "**/accesstransformer.cfg")
if (stonecutter.eval(stonecutter.current.version, ">=1.21.9")) {
exclude("**/pack.mcmeta")
rename("new-pack.mcmeta", "pack.mcmeta")
} else {
exclude("**/new-pack.mcmeta")
}
}
register<Copy>("buildAndCollect") {
group = "build"
from(remapJar.map { it.archiveFile })
into(rootProject.layout.buildDirectory.file("libs/${project.property("mod_version")}"))
dependsOn("build")
}
}