-
-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathbuild.fabric.gradle.kts
More file actions
91 lines (77 loc) · 3.12 KB
/
Copy pathbuild.fabric.gradle.kts
File metadata and controls
91 lines (77 loc) · 3.12 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
83
84
85
86
87
88
89
90
91
@file:Suppress("UnstableApiUsage")
import pl.skidam.automodpack.buildlogic.FabricPlugin.FabricExtension
plugins {
kotlin("jvm")
id("automodpack.common")
id("automodpack.utils")
id("net.fabricmc.fabric-loom-remap") apply false
id("net.fabricmc.fabric-loom") apply false
id("automodpack.fabric")
}
val fabric = the<FabricExtension>()
version = "${property("mod_version")}"
group = "${property("mod.group")}"
base.archivesName.set("${property("mod_name")}-mc${property("deps.minecraft")}-fabric".lowercase())
loom {
accessWidenerPath = rootProject.file(fabric.accessWidenerPath)
}
dependencies {
implementation(project(":core")) { isTransitive = false }
implementation(project(":loader-core")) { isTransitive = false }
minecraft("com.mojang:minecraft:${property("deps.minecraft")}")
if (!fabric.isUnobf) {
mappings(loom.officialMojangMappings())
}
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 (sc.current.parsed < "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 (sc.current.parsed >= "1.21.9") {
include(modImplementation(fabricApi.module("fabric-resource-loader-v1", property("deps.fabric-api") as String))!!)
}
}
java {
if (sc.current.parsed >= "26.1") {
sourceCompatibility = JavaVersion.VERSION_25
targetCompatibility = JavaVersion.VERSION_25
toolchain.languageVersion.set(JavaLanguageVersion.of(25))
} else if (sc.current.parsed >= "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 (fabric.isUnobf) {
exclude("**/automodpack.accesswidener")
rename("automodpack.unobf.accesswidener", "automodpack.accesswidener")
} else {
exclude("**/automodpack.unobf.accesswidener")
}
if (sc.current.parsed >= "1.21.9") {
exclude("**/pack.mcmeta")
rename("new-pack.mcmeta", "pack.mcmeta")
} else {
exclude("**/new-pack.mcmeta")
}
}
}