-
Notifications
You must be signed in to change notification settings - Fork 2
/
settings.gradle
124 lines (114 loc) · 4.35 KB
/
settings.gradle
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
/*
* This file is part of the Universal Mod Template
* licensed under the GNU GPL v3 License.
* (some parts of this file are originally from the Distant Horizons mod by James Seibel)
*
* Copyright (C) 2024 Leander Knüttel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* file changed by: Leander Knüttel
* date: 09.06.2024
*/
pluginManagement {
repositories {
maven {
name "Fabric"
url "https://maven.fabricmc.net/"
}
maven {
name "Forge"
url "https://maven.minecraftforge.net/"
}
maven {
name "NeoForge Releases"
url "https://maven.neoforged.net/releases/"
}
maven {
name "NeoForge Snapshot"
url "https://maven.neoforged.net/snapshots/"
}
maven {
name "Architectury (Better Forge because regular Forge is annoying)"
url "https://maven.architectury.dev/"
}
maven {
name "Quilt"
url "https://maven.quiltmc.org/repository/release"
}
maven { // Used for Vanilla Minecraft's libraries
name "Sponge"
url "https://repo.spongepowered.org/repository/maven-public/"
}
maven {
name "ParchmentMC"
url "https://maven.parchmentmc.org"
}
maven {
name "Spigot"
url "https://hub.spigotmc.org/nexus/content/repositories/snapshots/"
}
maven { // Used for ModPublisher
name "Firstdark"
url "https://maven.firstdark.dev/releases"
}
mavenCentral()
gradlePluginPortal()
// Not needed, but useful for debugging gradle plugins
mavenLocal()
}
}
/** Loads the VersionProperties field for the currently selected Minecraft version. */
def loadProperties() {
def defaultMcVersion = "1.20.4"
def mcVersion = ""
def mcVers = fileTree("versionProperties").files.name // Get all the files in "versionProperties"
mcVers.addAll(fileTree("versionProperties_disabled").files.name) //also include the disabled version properties (they will not be built)
for (int i = 0; i < mcVers.size(); i++) {
mcVers[i] = mcVers[i].replaceAll("\\.properties", "") // As we are getting the file names, we should remove the ".properties" at the end to get the versions
}
mcVers.sort() // Sort so it always goes from oldest to newest
int mcIndex = -1
println "Avalible MC versions: ${mcVers}"
if (hasProperty("mcVer")) {
mcVersion = mcVer
mcIndex = mcVers.indexOf(mcVer)
}
if (mcIndex == -1) {
println "No mcVer set or the set mcVer is invalid! Defaulting to ${defaultMcVersion}."
println "Tip: Use -PmcVer=\"${defaultMcVersion}\" in cmd arg to set mcVer."
mcVersion = defaultMcVersion
mcIndex = mcVers.indexOf(defaultMcVersion)
assert mcIndex != -1
}
println "Loading properties file at " + mcVersion + ".properties"
def props = new Properties()
props.load(new FileInputStream("$rootDir/versionProperties/"+"$mcVersion"+".properties"))
props.each { prop ->
gradle.ext.set(prop.key, prop.value)
// println "Added prop [key:" + prop.key + ", value:" + prop.value + "]"
}
gradle.ext.mcVers = mcVers
gradle.ext.mcIndex = mcIndex
}
loadProperties()
// sub-projects
include("common")
// Enables or disables the subprojects depending on whats in the versionProperties/mcVer.properties
for (loader in ((String) gradle.builds_for).split(",")) {
def loaderName = loader.strip() // Strip it in case a space is added before or after the comma
println "Adding loader " + loaderName
include(loaderName)
}
rootProject.name = "example_mod"