Skip to content

Commit cdafb2b

Browse files
authored
Merge pull request #605 from Polyfrost/DGT-2.71-and-MC-26.1
Dgt 2.71 and mc 26.1
2 parents 82c79bf + 50a2587 commit cdafb2b

21 files changed

Lines changed: 138 additions & 80 deletions

File tree

buildSrc/src/main/kotlin/org/polyfrost/gradle/addDependencies.kt

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ private val legacyFabricApiModules = listOf(
1414
private val fabricApiModules = listOf( // command-api-v2 introduced in 1.19, transitive-access-wideners-v1 introduced in 1.18
1515
"api-base",
1616
"lifecycle-events-v1",
17-
"key-binding-api-v1",
1817
"rendering-v1",
1918
"screen-api-v1"
2019
)
@@ -43,6 +42,7 @@ private val fabricApiModuleVersions = mapOf(
4342
"api-base-12109" to "0.5.2+2fa446b294", // 1.21.9
4443
"api-base-12110" to "1.0.0+14b92d8968", // 1.21.10
4544
"api-base-12111" to "1.0.5+4ebb5c0853", // 1.21.11
45+
"api-base-260100" to "2.0.0+574290ba7d", // 26.1
4646
"lifecycle-events-v1-common" to "1.1.0+2c3f108c81e6", // Common (Legacy Fabric API)
4747
"lifecycle-events-v1-10809" to "1.1.0+1.8.9+2c3f108c81e6", // 1.8.9
4848
"lifecycle-events-v1-11202" to "1.1.0+1.12.2+2c3f108c81e6", // 1.12.2
@@ -65,6 +65,7 @@ private val fabricApiModuleVersions = mapOf(
6565
"lifecycle-events-v1-12109" to "2.6.8+33df5e6e94", // 1.21.9
6666
"lifecycle-events-v1-12110" to "2.6.9+33df5e6e68", // 1.21.10
6767
"lifecycle-events-v1-12111" to "2.6.15+4ebb5c0853", // 1.21.11
68+
"lifecycle-events-v1-260100" to "4.0.2+a208210e7d", // 26.1
6869
"keybindings-api-v1-common" to "1.1.1+281301ea81e6", // Common (Legacy Fabric API)
6970
"keybindings-api-v1-10809" to "1.1.1+1.8.9+2c3f108c81e6", // 1.8.9
7071
"keybindings-api-v1-11202" to "1.1.1+1.12.2+2c3f108c81e6", // 1.12.2
@@ -87,6 +88,7 @@ private val fabricApiModuleVersions = mapOf(
8788
"key-binding-api-v1-12109" to "1.1.0+4ec8267494", // 1.21.9
8889
"key-binding-api-v1-12110" to "1.1.1+b3ba9c4868", // 1.21.10
8990
"key-binding-api-v1-12111" to "1.1.7+4fc5413f53", // 1.21.11
91+
"key-mapping-api-v1-260100" to "2.0.0+574290ba7d", // 26.1
9092
"rendering-api-v1-common" to "1.0.0+7c545fdb81e6", // Common (Legacy Fabric API)
9193
"rendering-api-v1-10809" to "1.0.0+1.8.9+2c3f108c81e6", // 1.8.9
9294
"rendering-api-v1-11202" to "1.0.0+1.8.9+2c3f108c81e6", // 1.12.2
@@ -109,6 +111,7 @@ private val fabricApiModuleVersions = mapOf(
109111
"rendering-v1-12109" to "15.0.2+9bce411b94", // 1.21.9
110112
"rendering-v1-12110" to "16.0.1+328a75ba68", // 1.21.10
111113
"rendering-v1-12111" to "16.2.5+1fb1cde953", // 1.21.11
114+
"rendering-v1-260100" to "18.0.0+a9f246707d", // 26.1
112115
"screen-api-v1-11605" to "1.0.1+3cc0f0907d", // 1.16.5
113116
"screen-api-v1-11701" to "1.0.5+cf39a74318", // 1.17.1
114117
"screen-api-v1-11802" to "1.0.11+d882b91560", // 1.18.2
@@ -128,6 +131,7 @@ private val fabricApiModuleVersions = mapOf(
128131
"screen-api-v1-12109" to "3.0.2+86b3ae5794", // 1.21.9
129132
"screen-api-v1-12110" to "3.1.0+9c82a79868", // 1.21.10
130133
"screen-api-v1-12111" to "3.1.7+4ebb5c0853", // 1.21.11
134+
"screen-api-v1-260100" to "4.0.0+574290ba7d", // 26.1
131135
"command-api-v1-11605" to "1.1.3+3cc0f0907d", // 1.16.5
132136
"command-api-v1-11701" to "1.1.4+cf39a74318", // 1.17.1
133137
"command-api-v1-11802" to "1.1.10+d7c144a860", // 1.18.2
@@ -147,6 +151,7 @@ private val fabricApiModuleVersions = mapOf(
147151
"command-api-v2-12109" to "2.3.5+33df5e6e94", // 1.21.9
148152
"command-api-v2-12110" to "2.3.7+328a75ba68", // 1.21.10
149153
"command-api-v2-12111" to "2.4.6+4ebb5c0853", // 1.21.11
154+
"command-api-v2-260100" to "3.0.0+574290ba7d", // 26.1
150155
"transitive-access-wideners-v1-11802" to "1.1.0+e747827960", // 1.18.2
151156
"transitive-access-wideners-v1-11902" to "1.3.3+08b73de490", // 1.19.2
152157
"transitive-access-wideners-v1-11904" to "3.3.0+1b5f819af4", // 1.19.4
@@ -164,6 +169,7 @@ private val fabricApiModuleVersions = mapOf(
164169
"transitive-access-wideners-v1-12109" to "6.5.2+5d9dbead94", // 1.21.9
165170
"transitive-access-wideners-v1-12110" to "6.5.3+41eb434368", // 1.21.10
166171
"transitive-access-wideners-v1-12111" to "7.0.7+1fb1cde953", // 1.21.11
172+
"transitive-access-wideners-v1-260100" to "8.0.1+a208210e7d", // 26.1
167173
)
168174

169175
/**
@@ -172,7 +178,7 @@ private val fabricApiModuleVersions = mapOf(
172178
* @param version The version of Minecraft. If null, the method is running inside the `:dependencies:legacy` module.
173179
* @param loader The mod loader being used.
174180
*/
175-
fun Project.provideIncludedDependencies(version: Triple<Int, Int, Int>?, loader: String?): List<OCDependency> { // Either a String or ExternalModuleDependency
181+
fun Project.provideIncludedDependencies(version: Triple<Int, Int, Int>?, loader: String?, shenanigans: String? = version?.toMCVer()): List<OCDependency> { // Either a String or ExternalModuleDependency
176182
project.logger.lifecycle("===> Adding dependencies for Minecraft ${version?.toMCVer()} & $loader")
177183

178184
val libs = rootProject
@@ -201,17 +207,21 @@ fun Project.provideIncludedDependencies(version: Triple<Int, Int, Int>?, loader:
201207

202208
deps.add(libs.findLibrary("copycat-image-awt").get().get())
203209

204-
if (version != null && version.second >= 16) {
210+
if (version != null && (version.second >= 16 || version.first >= 2)) {
205211
logger.lifecycle("===> Adding LWJGL dependencies for Minecraft ${version.toMCVer()} & $loader")
206212

207213
// Modern (1.16+)
208214
val lwjglBase = "org.lwjgl:lwjgl"
209-
val lwjglVersion = when (version.second) {
210-
in 16..18 -> "3.2.2"
211-
19 -> "3.3.1"
212-
20 -> "3.3.2"
213-
21 -> "3.3.3"
214-
else -> error("Unsupported Minecraft version: ${version.toMCVer()}")
215+
val lwjglVersion = if (version.first >= 2) {
216+
"3.3.3"
217+
} else {
218+
when (version.second) {
219+
in 16..18 -> "3.2.2"
220+
19 -> "3.3.1"
221+
20 -> "3.3.2"
222+
21 -> "3.3.3"
223+
else -> error("Unsupported Minecraft version: ${version.toMCVer()}")
224+
}
215225
}
216226

217227
deps.add("$lwjglBase-tinyfd:$lwjglVersion")
@@ -243,8 +253,8 @@ fun Project.provideIncludedDependencies(version: Triple<Int, Int, Int>?, loader:
243253
actualDeps.add(OCDependency(dep))
244254
}
245255
if (version != null) {
246-
actualDeps.add(OCDependency("dev.deftu:textile-${version.toMCVer()}-$loader:${libs.findVersion("textile").get().displayName}", true))
247-
actualDeps.add(OCDependency("dev.deftu:omnicore-${version.toMCVer()}-$loader:${libs.findVersion("omnicore").get().displayName}", true))
256+
actualDeps.add(OCDependency("dev.deftu:textile-${shenanigans}-$loader:${libs.findVersion("textile").get().displayName}", true))
257+
actualDeps.add(OCDependency("dev.deftu:omnicore-${shenanigans}-$loader:${libs.findVersion("omnicore").get().displayName}", true))
248258
}
249259

250260
return actualDeps
@@ -253,7 +263,7 @@ fun Project.provideIncludedDependencies(version: Triple<Int, Int, Int>?, loader:
253263
fun Project.provideFabricApiDependency(version: Triple<Int, Int, Int>): List<OCDependency> {
254264
val deps = mutableListOf<OCDependency>()
255265

256-
if (version.second <= 12) {
266+
if (version.first == 1 && version.second <= 12) {
257267
// Legacy Fabric
258268
for (module in legacyFabricApiModules) {
259269
val commonVersionValue = fabricApiModuleVersions["$module-common"] ?: error("No version found for $module-common")
@@ -265,14 +275,19 @@ fun Project.provideFabricApiDependency(version: Triple<Int, Int, Int>): List<OCD
265275
// Modern Fabric
266276
val finalList = mutableListOf<String>()
267277
finalList.addAll(fabricApiModules)
268-
if (version.second >= 18) {
278+
if (version.first >= 2 || version.second >= 18) {
269279
finalList.add("transitive-access-wideners-v1")
270280
}
271-
if (version.second >= 19) {
281+
if (version.first >= 2 || version.second >= 19) {
272282
finalList.add("command-api-v2")
273283
} else {
274284
finalList.add("command-api-v1")
275285
}
286+
if (version.first >= 2) {
287+
finalList.add("key-mapping-api-v1")
288+
} else {
289+
finalList.add("key-binding-api-v1")
290+
}
276291
for (module in finalList) {
277292
val mcVersionValue = fabricApiModuleVersions["$module-${version.toPreprocessorNumber()}"] ?: error("No version found for $module-${version.toMCVer()}")
278293
deps.add(OCDependency("net.fabricmc.fabric-api:fabric-$module:$mcVersionValue", true))

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ksp.incremental=false
1010

1111
dgt.java.version=8
1212
dgt.loom.mappings=official-like
13-
dgt.minecraft.revision=4
13+
dgt.minecraft.revision=5
1414

1515
# Project Configuration
1616
project.group=org.polyfrost.oneconfig

gradle/libs.versions.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
# Libraries
44
# All
5-
kotlin = "2.2.10"
5+
kotlin = "2.3.0"
66
kotlinx-coroutines = "1.10.2"
77
kotlinx-atomicfu = "0.29.0"
8-
fabric-language-kotlin = "1.13.5+kotlin.2.2.10"
8+
fabric-language-kotlin = "1.13.8+kotlin.2.3.0"
99
google-ksp = "2.2.10-2.0.2"
1010
polyui = "2.0.7"
1111
annotations = "24.1.0"
@@ -21,8 +21,8 @@ copycat = "0.1.3"
2121
copycat-image-awt = "0.1.1"
2222

2323
# Per version
24-
textile = "1.0.0-beta.11"
25-
omnicore = "1.0.0-beta.40"
24+
textile = "1.0.0-beta.17"
25+
omnicore = "1.0.0-beta.41"
2626
lwjgl = "3.3.3" # All downloaded by the isolated-lwjgl3-loader
2727

2828
# Legacy only
@@ -35,7 +35,7 @@ brigadier = "1.0.18"
3535
oneconfig-loader = "1.1.0-alpha.48"
3636

3737
# Gradle
38-
dgt = "2.69.0"
38+
dgt = "2.73.0"
3939
kotlinx-abi = "0.18.1"
4040
licenser = "2.1.1"
4141
jetbrains-idea-ext = "1.3"

gradle/wrapper/gradle-wrapper.jar

130 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

minecraft/build.gradle.kts

Lines changed: 42 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import com.replaymod.gradle.preprocess.PreprocessTask
66
import com.replaymod.gradle.preprocess.ProjectGraphNode
77
import com.replaymod.gradle.preprocess.RootPreprocessExtension
88
import dev.deftu.gradle.utils.GameSide
9+
import dev.deftu.gradle.utils.version.MinecraftDropVersion
910
import dev.deftu.gradle.utils.version.MinecraftReleaseVersion
1011
import dev.deftu.gradle.utils.version.MinecraftVersions
1112
import gg.essential.gradle.util.RelocationTransform.Companion.registerRelocationAttribute
@@ -129,7 +130,7 @@ fun DependencyHandlerScope.handleApiDep(dependency: String, isMod: Boolean = fal
129130

130131
fun DependencyHandlerScope.handleApiDep(dependency: ExternalModuleDependency, isMod: Boolean = false) {
131132
val dep = "${dependency.group}:${dependency.name}:${dependency.version}"
132-
if (isMod) "oneConfigModulesCompileOnlyApi"(modApi(dep) {
133+
if (isMod) "oneConfigModulesCompileOnlyApi"(maybeModApi(dep) {
133134
isTransitive = false
134135
attributes {
135136
attribute(includeInLoader, JBoolean.TRUE)
@@ -167,7 +168,7 @@ dependencies {
167168
)
168169

169170
fun DependencyHandlerScope.compileOnlyCompat(notation: String?) =
170-
notation?.let { modCompileOnly(it) { isTransitive = false } }
171+
notation?.let { maybeModCompileOnly(it) { isTransitive = false } }
171172

172173
fun DependencyHandlerScope.compileOnlyCompat(notation: CompatDependency?) {
173174
when {
@@ -177,9 +178,14 @@ dependencies {
177178
}
178179
}
179180

180-
val mcVersion = mcData.version as MinecraftReleaseVersion
181-
val tripleVersion = Triple(mcVersion.major, mcVersion.minor, mcVersion.patch)
182-
val mcVersionString = listOf(mcVersion.major, mcVersion.minor, mcVersion.patch).joinToString(".")
181+
val mcVersion = mcData.version
182+
val tripleVersion = when (mcVersion) {
183+
is MinecraftDropVersion -> Triple(mcVersion.year, mcVersion.drop, mcVersion.patch)
184+
is MinecraftReleaseVersion -> Triple(mcVersion.major, mcVersion.minor, mcVersion.patch)
185+
else -> error("no")
186+
}
187+
188+
val mcVersionString = mcData.version.toString()
183189

184190
compileOnlyCompat("gg.essential:vigilance-1.8.9-forge:299")
185191
compileOnlyCompat("org.notenoughupdates.moulconfig:common:3.11.0")
@@ -284,8 +290,9 @@ dependencies {
284290

285291

286292
provideIncludedDependencies(
287-
Triple(mcVersion.major, mcVersion.minor, mcVersion.patch),
288-
mcData.loader.friendlyString
293+
tripleVersion,
294+
mcData.loader.friendlyString,
295+
mcVersion.toString()
289296
).forEach {
290297
if (it.dep is String) {
291298
@Suppress("USELESS_CAST")
@@ -298,7 +305,7 @@ dependencies {
298305
if (mcData.isFabric) {
299306
provideFabricApiDependency(tripleVersion).forEach {
300307
@Suppress("USELESS_CAST")
301-
modApi(if (it.dep is String) it.dep as String else "${(it.dep as ExternalModuleDependency).group}:${(it.dep as ExternalModuleDependency).name}:${(it.dep as ExternalModuleDependency).version}") {
308+
maybeModApi(if (it.dep is String) it.dep as String else "${(it.dep as ExternalModuleDependency).group}:${(it.dep as ExternalModuleDependency).name}:${(it.dep as ExternalModuleDependency).version}") {
302309
isTransitive = false
303310
}
304311
}
@@ -351,35 +358,43 @@ dependencies {
351358
}
352359
}
353360

354-
if ((mcData.version as MinecraftReleaseVersion).isNewerThan(MinecraftVersions.VERSION_1_21_4)) {
361+
if (mcData.version > MinecraftVersions.VERSION_1_21_4) {
355362
compileOnly("net.azureaaron:dandelion:1.0.0-alpha.3") { isTransitive = false }
356363
}
357364
api("dev.deftu:enhancedeventbus:2.0.0") // TODO
358365
}
359366

360367
tasks {
368+
val manifestFunc = { manifest: Manifest ->
369+
val attributesMap = buildMap<String, Any> {
370+
putAll(
371+
mapOf(
372+
"Specification-Title" to modData.id,
373+
"Specification-Vendor" to "Polyfrost",
374+
"Specification-Version" to "1", // We are version 1 of ourselves, whatever the hell that means
375+
"Implementation-Title" to rootProject.name,
376+
"Implementation-Version" to project.version,
377+
"Implementation-Vendor" to "Polyfrost",
378+
"Implementation-Timestamp" to SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date()),
379+
"OneConfig-Main-Class" to "org.polyfrost.oneconfig.internal.bootstrap.Bootstrap",
380+
"MixinConfigs" to "mixins.oneconfigv1.init.json,mixins.oneconfigv1.json",)
381+
)
382+
}
383+
manifest.attributes(attributesMap)
384+
Unit
385+
}
386+
361387
withType(Jar::class) {
362388
exclude("**/**_Test.**")
363389
exclude("**/**_Test$**.**")
364390
}
365-
remapJar {
366-
manifest {
367-
val attributesMap = buildMap<String, Any> {
368-
putAll(
369-
mapOf(
370-
"Specification-Title" to modData.id,
371-
"Specification-Vendor" to "Polyfrost",
372-
"Specification-Version" to "1", // We are version 1 of ourselves, whatever the hell that means
373-
"Implementation-Title" to rootProject.name,
374-
"Implementation-Version" to project.version,
375-
"Implementation-Vendor" to "Polyfrost",
376-
"Implementation-Timestamp" to SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date()),
377-
"OneConfig-Main-Class" to "org.polyfrost.oneconfig.internal.bootstrap.Bootstrap",
378-
"MixinConfigs" to "mixins.oneconfigv1.init.json,mixins.oneconfigv1.json",
379-
)
380-
)
381-
}
382-
attributes(attributesMap)
391+
if (mcData.version.isDrop) {
392+
jar {
393+
manifest(manifestFunc)
394+
}
395+
} else {
396+
named<org.gradle.jvm.tasks.Jar>("remapJar") {
397+
manifest(manifestFunc)
383398
}
384399
}
385400
processResources {

minecraft/root.gradle.kts

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,31 @@ preprocess {
1414
strictExtraMappings.set(true)
1515
// FOR ALL NEW VERSIONS ENSURE TO UPDATE settings.gradle.kts !
1616

17-
"1.21.11-fabric"(1_21_11, "srg") {
18-
"1.21.11-neoforge"(1_21_11, "srg") {
19-
"1.21.10-neoforge"(1_21_10, "srg") {
20-
"1.21.10-fabric"(1_21_10, "srg") {
21-
"1.21.8-fabric"(1_21_08, "srg") {
22-
"1.21.8-neoforge"(1_21_08, "srg") {
23-
"1.21.5-neoforge"(1_21_05, "srg") {
24-
"1.21.5-fabric"(1_21_05, "srg") {
25-
"1.21.4-fabric"(1_21_04, "srg") {
26-
"1.21.4-neoforge"(1_21_04, "srg") {
27-
"1.21.1-neoforge"(1_21_01, "srg", file("mappings/1.21.4-forge+1.21.1-forge.txt")) {
28-
"1.21.1-fabric"(1_21_01, "srg") {
29-
"1.20.4-fabric"(1_20_04, "srg") {
30-
"1.20.4-neoforge"(1_20_04, "srg") {
31-
"1.20.4-forge"(1_20_04, "srg") {
32-
"1.20.1-forge"(1_20_01, "srg", file("mappings/1.20.4-forge+1.20.1-forge.txt")) {
33-
"1.20.1-fabric"(1_20_01, "srg") {
34-
"1.16.5-fabric"(1_16_05, "srg", file("mappings/1.20.1-fabric+1.16.5-fabric.txt")) {
35-
"1.16.5-forge"(1_16_05, "srg") {
36-
"1.12.2-forge"(1_12_02, "srg", file("mappings/1.16.5-forge+1.12.2-forge.txt")) {
37-
"1.12.2-fabric"(1_12_02, "srg") {
38-
"1.8.9-fabric"(1_08_09, "srg") {
39-
"1.8.9-forge"(1_08_09, "srg")
17+
"26.1-fabric"(26_01_00, "srg") {
18+
"1.21.11-fabric"(1_21_11, "srg") {
19+
"1.21.11-neoforge"(1_21_11, "srg") {
20+
"1.21.10-neoforge"(1_21_10, "srg") {
21+
"1.21.10-fabric"(1_21_10, "srg") {
22+
"1.21.8-fabric"(1_21_08, "srg") {
23+
"1.21.8-neoforge"(1_21_08, "srg") {
24+
"1.21.5-neoforge"(1_21_05, "srg") {
25+
"1.21.5-fabric"(1_21_05, "srg") {
26+
"1.21.4-fabric"(1_21_04, "srg") {
27+
"1.21.4-neoforge"(1_21_04, "srg") {
28+
"1.21.1-neoforge"(1_21_01, "srg", file("mappings/1.21.4-forge+1.21.1-forge.txt")) {
29+
"1.21.1-fabric"(1_21_01, "srg") {
30+
"1.20.4-fabric"(1_20_04, "srg") {
31+
"1.20.4-neoforge"(1_20_04, "srg") {
32+
"1.20.4-forge"(1_20_04, "srg") {
33+
"1.20.1-forge"(1_20_01, "srg", file("mappings/1.20.4-forge+1.20.1-forge.txt")) {
34+
"1.20.1-fabric"(1_20_01, "srg") {
35+
"1.16.5-fabric"(1_16_05, "srg", file("mappings/1.20.1-fabric+1.16.5-fabric.txt")) {
36+
"1.16.5-forge"(1_16_05, "srg") {
37+
"1.12.2-forge"(1_12_02, "srg", file("mappings/1.16.5-forge+1.12.2-forge.txt")) {
38+
"1.12.2-fabric"(1_12_02, "srg") {
39+
"1.8.9-fabric"(1_08_09, "srg") {
40+
"1.8.9-forge"(1_08_09, "srg")
41+
}
4042
}
4143
}
4244
}

minecraft/src/main/resources/fabric.mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
},
2929
"depends": {
3030
"fabricloader": ">=0.12.0",
31-
"minecraft": "${mc_version}"
31+
"minecraft": "${fabric_mc_version}"
3232
},
3333
"custom": {
3434
"modmenu": {

0 commit comments

Comments
 (0)