-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.gradle.kts
63 lines (53 loc) · 1.77 KB
/
settings.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
import java.io.FileInputStream
import java.util.*
pluginManagement.repositories {
maven {
name = "Architectury"
url = uri("https://maven.architectury.dev/")
}
maven {
name = "Fabric"
url = uri("https://maven.fabricmc.net/")
}
maven {
name = "Forge"
url = uri("https://maven.minecraftforge.net/")
}
maven {
name = "NeoForge"
url = uri("https://maven.neoforged.net/releases/")
}
gradlePluginPortal()
}
val minecraftVersion: String by settings
fun loadProperties() {
val defaultVersion = "1.21"
val availableVersions: MutableList<String> = fileTree("versionProperties").files.map { file -> file.name }.toMutableList()
for ((index, s) in availableVersions.withIndex()) {
availableVersions[index] = s.replace(".properties", "")
}
availableVersions.sort()
println("Available Minecraft versions: ${availableVersions}")
var selectedVersion = minecraftVersion
var versionIndex = availableVersions.indexOf(minecraftVersion)
if (versionIndex == -1) {
println("No 'minecraftVersion' set or the set 'minecraftVersion' is invalid! Defaulting to ${defaultVersion}.")
selectedVersion = defaultVersion
versionIndex = availableVersions.indexOf(defaultVersion)
}
println("Loading properties file at ${selectedVersion}.properties")
val properties = Properties()
properties.load(FileInputStream("${rootDir}/versionProperties/${selectedVersion}.properties"))
for (property in properties) {
gradle.extra.set(property.key.toString(), property.value.toString())
}
gradle.extra.set("availableVersions", availableVersions)
gradle.extra.set("versionIndex", versionIndex)
}
loadProperties()
rootProject.name = "Panda's Extra Detail's"
include("common")
gradle.extra.properties["supportedModLoaders"].toString().split(",").forEach {
println("Adding loader $it")
include(it)
}