-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
157 lines (131 loc) · 5.15 KB
/
build.gradle
File metadata and controls
157 lines (131 loc) · 5.15 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
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
148
149
150
151
152
153
154
155
156
157
import net.darkhax.curseforgegradle.TaskPublishCurseForge
import net.darkhax.curseforgegradle.UploadArtifact
plugins {
id 'dev.architectury.loom' version '1.10-SNAPSHOT'
id "com.gradleup.shadow" version "8.3.9"
id 'net.darkhax.curseforgegradle' version '1.1.+'
}
boolean isNeo = loom.platform.get().displayName() == "NeoForge"
configurations {
shadow
implementation.extendsFrom(shadow)
}
shadowJar {
configurations = [project.configurations.shadow]
if (!isNeo) relocate "com.llamalad7.mixinextras", "me.kall.${archives_name}.mixinextras"
mergeServiceFiles()
archiveClassifier = "dev-shadow"
exclude "LICENSE_MixinExtras"
}
remapJar {
dependsOn tasks.named("shadowJar")
inputFile = shadowJar.archiveFile
archiveClassifier = null
exclude "LICENSE_MixinExtras"
}
group = project.maven_group
version = "${project.minecraft_version}-${project.mod_version}"
base {
archivesName = project.archives_name
}
loom {
silentMojangMappingsLicense()
if (!isNeo) {
forge {
mixinConfig "${archives_name}.mixins.json"
}
}
}
repositories {
maven { name = "ParchmentMC"; url = 'https://maven.parchmentmc.org' }
maven { name = "MinecraftForge"; url = "https://files.minecraftforge.net/maven/" }
maven { name = "NeoForged"; url = 'https://maven.neoforged.net/releases' }
maven { name = "FabricMC"; url = "https://maven.fabricmc.net/" }
maven { name = "Architectury"; url = "https://maven.architectury.dev/" }
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
content { includeGroup "maven.modrinth" }
}
maven {
name = "CurseMaven"
url = "https://cursemaven.com"
content { includeGroup "curse.maven" }
}
}
def versionMap = [
"1.20.1" : [forge: "47.4.2" , parchment: "2023.09.03", duplicationless: "7349275"],
"1.16.5" : [forge: "36.2.42" , parchment: "2022.03.06", duplicationless: "7349267"],
"1.21.1" : [neo : "21.1.192" , parchment: "2024.11.17", duplicationless: "7349264"],
"1.21.11": [neo : "21.11.30-beta", parchment: "2025.12.20", duplicationless: "7479295"]
]
HashMap<String, String> versionInfo = versionMap[minecraft_version]
dependencies {
minecraft "net.minecraft:minecraft:$project.minecraft_version"
mappings loom.layered {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${project.minecraft_version}:${versionInfo.parchment}@zip")
}
if (isNeo) {
neoForge "net.neoforged:neoforge:${versionInfo.neo}"
} else {
forge "net.minecraftforge:forge:${project.minecraft_version}-${versionInfo.forge}"
}
if (!isNeo) shadow(annotationProcessor("io.github.llamalad7:mixinextras-common:${project.mixinextras_version}"))
modImplementation("curse.maven:duplicationless-1380105:${versionInfo.duplicationless}")
modImplementation("curse.maven:accelerated-decay-699872:4863307")
}
processResources {
inputs.property 'version', project.version
if (isNeo) {
filesMatching('META-INF/neoforge.mods.toml') {
expand version: project.version
}
exclude("META-INF/mods.toml")
} else {
filesMatching('META-INF/mods.toml') {
expand version: project.version
}
exclude("META-INF/neoforge.mods.toml")
}
}
def javaInfoMap = [
"1.20.1": [version : JavaVersion.VERSION_17, release : 17, supported: ["Java 17", "Java 21", "Java 22"]],
"1.16.5": [version : JavaVersion.VERSION_1_8, release : 8, supported: ["Java 8", "Java 17", "Java 21", "Java 22"]],
"1.21.1": [version : JavaVersion.VERSION_21, release : 21, supported: ["Java 21", "Java 22"]],
"1.21.11": [version : JavaVersion.VERSION_21, release : 21, supported: ["Java 21", "Java 22"]]
]
def javaInfo = javaInfoMap[minecraft_version]
java {
withSourcesJar()
JavaVersion javaVer = (JavaVersion) javaInfo.version
sourceCompatibility = javaVer
targetCompatibility = javaVer
}
tasks.withType(JavaCompile).configureEach {
it.options.release = (int) javaInfo.release
}
String CHANGELOG = file("CHANGELOG.md").getText("UTF-8")
tasks.register("publishCurseForge", TaskPublishCurseForge) {
if (!cf_project_id.isEmpty()) {
apiToken = System.getenv("CURSEFORGE_TOKEN")
disableVersionDetection()
UploadArtifact mainFile = upload(cf_project_id, remapJar)
mainFile.displayName = "${archives_name}-${version}"
mainFile.releaseType = "release"
mainFile.changelog = CHANGELOG
mainFile.changelogType = "markdown"
mainFile.addModLoader(isNeo ? "NeoForge" : "Forge")
Iterator<String> supported = javaInfo.supported.iterator()
while (supported.hasNext()) {
mainFile.addJavaVersion(supported.next());
}
mainFile.addGameVersion(minecraft_version)
mainFile.addRequirement("duplicationless")
UploadArtifact sourcesFile = mainFile.withAdditionalFile(sourcesJar)
sourcesFile.changelog = CHANGELOG
sourcesFile.changelogType = "markdown"
} else {
System.err.println("CurseForge Project ID is not provided")
}
}