forked from okx-code/civmodern
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
147 lines (131 loc) · 4.53 KB
/
build.gradle.kts
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
plugins {
id("fabric-loom") version("1.9-SNAPSHOT")
}
private val mod_name = "CivianMod"
private val mod_version = "1.21.4-6"
private val mod_group = "uk.protonull.civianmod"
private val mod_description = "Civ utilities"
private val mod_authors = listOf("Okx", "Protonull")
private val mod_copyright = "GPLv3"
private val mod_home_url = "https://github.com/Protonull/CivianMod"
private val mod_source_url = "https://github.com/Protonull/CivianMod"
private val mod_issues_url = "https://github.com/Protonull/CivianMod/issues"
private val dep_minecraft_version = "1.21.4"
// https://parchmentmc.org/docs/getting-started
private val dep_parchment_minecraft_version = "1.21.4"
private val dep_parchment_mappings_version = "2025.03.23"
// https://fabricmc.net/versions.html
private val dep_fabric_loader_version = "0.16.10"
private val dep_fabric_api_version = "0.119.2+1.21.4"
// https://maven.isxander.dev/#/releases/dev/isxander/yet-another-config-lib/
// https://modrinth.com/mod/yacl/versions?c=release&l=fabric
private val dep_yacl_version = "3.6.6+1.21.4-fabric"
// https://maven.terraformersmc.com/releases/com/terraformersmc/modmenu/
// https://modrinth.com/mod/modmenu/versions?c=release&l=fabric
private val dep_modmenu_version = "13.0.3"
version = mod_version
group = "$mod_group.mod.fabric"
base {
archivesName = mod_name
}
loom {
accessWidenerPath = file("src/main/resources/civianmod.accesswidener")
runConfigs.configureEach {
this.programArgs += "--username LocalModTester".split(" ")
}
}
dependencies {
minecraft("com.mojang:minecraft:$dep_minecraft_version")
loom {
@Suppress("UnstableApiUsage")
mappings(layered {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-$dep_parchment_minecraft_version:$dep_parchment_mappings_version@zip")
})
}
modImplementation("net.fabricmc:fabric-loader:$dep_fabric_loader_version")
modImplementation("net.fabricmc.fabric-api:fabric-api:$dep_fabric_api_version")
modImplementation("dev.isxander:yet-another-config-lib:$dep_yacl_version")
modImplementation("com.terraformersmc:modmenu:$dep_modmenu_version")
// This is literally only here to make Minecraft SHUT UP about non-signed messages while testing.
// https://modrinth.com/mod/no-chat-reports/versions?c=release&l=fabric
modLocalRuntime("maven.modrinth:no-chat-reports:9xt05630")
}
repositories {
maven(url = "https://maven.parchmentmc.org") {
name = "ParchmentMC"
}
maven(url = "https://api.modrinth.com/maven") {
name = "Modrinth"
content {
includeGroup("maven.modrinth")
}
}
// For YACL
maven("https://maven.isxander.dev/releases/") {
name = "Xander Maven"
}
// For ModMenu
maven(url = "https://maven.terraformersmc.com/") {
name = "Terraformers"
}
}
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
tasks {
jar {
from(file("LICENSE.txt")) {
rename { "LICENSE_$mod_name" }
}
}
compileJava {
options.encoding = "UTF-8"
options.release = 21
}
processResources {
filesMatching("fabric.mod.json") {
expand(
"mod_name" to mod_name,
"mod_version" to mod_version,
"mod_description" to mod_description,
"mod_copyright" to mod_copyright,
"mod_home_url" to mod_home_url,
"mod_source_url" to mod_source_url,
"mod_issues_url" to mod_issues_url,
"minecraft_version" to dep_minecraft_version,
"fabric_loader_version" to dep_fabric_loader_version,
"modmenu_version" to dep_modmenu_version,
"yacl_version" to dep_yacl_version,
)
filter {
it.replace(
"\"%FABRIC_AUTHORS_ARRAY%\"",
groovy.json.JsonBuilder(mod_authors).toString()
)
}
}
filesMatching("assets/civianmod/lang/*.json") {
expand(
"mod_name" to mod_name,
)
}
}
register<Delete>("cleanJar") {
delete(fileTree("./dist") {
include("*.jar")
})
}
register<Copy>("copyJar") {
dependsOn(getByName("cleanJar"))
from(getByName("remapJar"))
into("./dist")
}
build {
dependsOn(getByName("copyJar"))
}
}