Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 29 additions & 14 deletions buildSrc/src/main/kotlin/org/polyfrost/gradle/addDependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ private val legacyFabricApiModules = listOf(
private val fabricApiModules = listOf( // command-api-v2 introduced in 1.19, transitive-access-wideners-v1 introduced in 1.18
"api-base",
"lifecycle-events-v1",
"key-binding-api-v1",
"rendering-v1",
"screen-api-v1"
)
Expand Down Expand Up @@ -43,6 +42,7 @@ private val fabricApiModuleVersions = mapOf(
"api-base-12109" to "0.5.2+2fa446b294", // 1.21.9
"api-base-12110" to "1.0.0+14b92d8968", // 1.21.10
"api-base-12111" to "1.0.5+4ebb5c0853", // 1.21.11
"api-base-260100" to "2.0.0+574290ba7d", // 26.1
"lifecycle-events-v1-common" to "1.1.0+2c3f108c81e6", // Common (Legacy Fabric API)
"lifecycle-events-v1-10809" to "1.1.0+1.8.9+2c3f108c81e6", // 1.8.9
"lifecycle-events-v1-11202" to "1.1.0+1.12.2+2c3f108c81e6", // 1.12.2
Expand All @@ -65,6 +65,7 @@ private val fabricApiModuleVersions = mapOf(
"lifecycle-events-v1-12109" to "2.6.8+33df5e6e94", // 1.21.9
"lifecycle-events-v1-12110" to "2.6.9+33df5e6e68", // 1.21.10
"lifecycle-events-v1-12111" to "2.6.15+4ebb5c0853", // 1.21.11
"lifecycle-events-v1-260100" to "4.0.2+a208210e7d", // 26.1
"keybindings-api-v1-common" to "1.1.1+281301ea81e6", // Common (Legacy Fabric API)
"keybindings-api-v1-10809" to "1.1.1+1.8.9+2c3f108c81e6", // 1.8.9
"keybindings-api-v1-11202" to "1.1.1+1.12.2+2c3f108c81e6", // 1.12.2
Expand All @@ -87,6 +88,7 @@ private val fabricApiModuleVersions = mapOf(
"key-binding-api-v1-12109" to "1.1.0+4ec8267494", // 1.21.9
"key-binding-api-v1-12110" to "1.1.1+b3ba9c4868", // 1.21.10
"key-binding-api-v1-12111" to "1.1.7+4fc5413f53", // 1.21.11
"key-mapping-api-v1-260100" to "2.0.0+574290ba7d", // 26.1
"rendering-api-v1-common" to "1.0.0+7c545fdb81e6", // Common (Legacy Fabric API)
"rendering-api-v1-10809" to "1.0.0+1.8.9+2c3f108c81e6", // 1.8.9
"rendering-api-v1-11202" to "1.0.0+1.8.9+2c3f108c81e6", // 1.12.2
Expand All @@ -109,6 +111,7 @@ private val fabricApiModuleVersions = mapOf(
"rendering-v1-12109" to "15.0.2+9bce411b94", // 1.21.9
"rendering-v1-12110" to "16.0.1+328a75ba68", // 1.21.10
"rendering-v1-12111" to "16.2.5+1fb1cde953", // 1.21.11
"rendering-v1-260100" to "18.0.0+a9f246707d", // 26.1
"screen-api-v1-11605" to "1.0.1+3cc0f0907d", // 1.16.5
"screen-api-v1-11701" to "1.0.5+cf39a74318", // 1.17.1
"screen-api-v1-11802" to "1.0.11+d882b91560", // 1.18.2
Expand All @@ -128,6 +131,7 @@ private val fabricApiModuleVersions = mapOf(
"screen-api-v1-12109" to "3.0.2+86b3ae5794", // 1.21.9
"screen-api-v1-12110" to "3.1.0+9c82a79868", // 1.21.10
"screen-api-v1-12111" to "3.1.7+4ebb5c0853", // 1.21.11
"screen-api-v1-260100" to "4.0.0+574290ba7d", // 26.1
"command-api-v1-11605" to "1.1.3+3cc0f0907d", // 1.16.5
"command-api-v1-11701" to "1.1.4+cf39a74318", // 1.17.1
"command-api-v1-11802" to "1.1.10+d7c144a860", // 1.18.2
Expand All @@ -147,6 +151,7 @@ private val fabricApiModuleVersions = mapOf(
"command-api-v2-12109" to "2.3.5+33df5e6e94", // 1.21.9
"command-api-v2-12110" to "2.3.7+328a75ba68", // 1.21.10
"command-api-v2-12111" to "2.4.6+4ebb5c0853", // 1.21.11
"command-api-v2-260100" to "3.0.0+574290ba7d", // 26.1
"transitive-access-wideners-v1-11802" to "1.1.0+e747827960", // 1.18.2
"transitive-access-wideners-v1-11902" to "1.3.3+08b73de490", // 1.19.2
"transitive-access-wideners-v1-11904" to "3.3.0+1b5f819af4", // 1.19.4
Expand All @@ -164,6 +169,7 @@ private val fabricApiModuleVersions = mapOf(
"transitive-access-wideners-v1-12109" to "6.5.2+5d9dbead94", // 1.21.9
"transitive-access-wideners-v1-12110" to "6.5.3+41eb434368", // 1.21.10
"transitive-access-wideners-v1-12111" to "7.0.7+1fb1cde953", // 1.21.11
"transitive-access-wideners-v1-260100" to "8.0.1+a208210e7d", // 26.1
)

/**
Expand All @@ -172,7 +178,7 @@ private val fabricApiModuleVersions = mapOf(
* @param version The version of Minecraft. If null, the method is running inside the `:dependencies:legacy` module.
* @param loader The mod loader being used.
*/
fun Project.provideIncludedDependencies(version: Triple<Int, Int, Int>?, loader: String?): List<OCDependency> { // Either a String or ExternalModuleDependency
fun Project.provideIncludedDependencies(version: Triple<Int, Int, Int>?, loader: String?, shenanigans: String? = version?.toMCVer()): List<OCDependency> { // Either a String or ExternalModuleDependency
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter name "shenanigans" is unprofessional and unclear. Consider renaming it to something more descriptive like "mcVersionString" or "fabricMcVersion" to better indicate its purpose as a Minecraft version string override.

Copilot uses AI. Check for mistakes.
project.logger.lifecycle("===> Adding dependencies for Minecraft ${version?.toMCVer()} & $loader")

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

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

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

// Modern (1.16+)
val lwjglBase = "org.lwjgl:lwjgl"
val lwjglVersion = when (version.second) {
in 16..18 -> "3.2.2"
19 -> "3.3.1"
20 -> "3.3.2"
21 -> "3.3.3"
else -> error("Unsupported Minecraft version: ${version.toMCVer()}")
val lwjglVersion = if (version.first >= 2) {
"3.3.3"
} else {
when (version.second) {
in 16..18 -> "3.2.2"
19 -> "3.3.1"
20 -> "3.3.2"
21 -> "3.3.3"
else -> error("Unsupported Minecraft version: ${version.toMCVer()}")
}
}

deps.add("$lwjglBase-tinyfd:$lwjglVersion")
Expand Down Expand Up @@ -243,8 +253,8 @@ fun Project.provideIncludedDependencies(version: Triple<Int, Int, Int>?, loader:
actualDeps.add(OCDependency(dep))
}
if (version != null) {
actualDeps.add(OCDependency("dev.deftu:textile-${version.toMCVer()}-$loader:${libs.findVersion("textile").get().displayName}", true))
actualDeps.add(OCDependency("dev.deftu:omnicore-${version.toMCVer()}-$loader:${libs.findVersion("omnicore").get().displayName}", true))
actualDeps.add(OCDependency("dev.deftu:textile-${shenanigans}-$loader:${libs.findVersion("textile").get().displayName}", true))
actualDeps.add(OCDependency("dev.deftu:omnicore-${shenanigans}-$loader:${libs.findVersion("omnicore").get().displayName}", true))
}

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

if (version.second <= 12) {
if (version.first == 1 && version.second <= 12) {
// Legacy Fabric
for (module in legacyFabricApiModules) {
val commonVersionValue = fabricApiModuleVersions["$module-common"] ?: error("No version found for $module-common")
Expand All @@ -265,14 +275,19 @@ fun Project.provideFabricApiDependency(version: Triple<Int, Int, Int>): List<OCD
// Modern Fabric
val finalList = mutableListOf<String>()
finalList.addAll(fabricApiModules)
if (version.second >= 18) {
if (version.first >= 2 || version.second >= 18) {
finalList.add("transitive-access-wideners-v1")
}
if (version.second >= 19) {
if (version.first >= 2 || version.second >= 19) {
finalList.add("command-api-v2")
} else {
finalList.add("command-api-v1")
}
if (version.first >= 2) {
finalList.add("key-mapping-api-v1")
} else {
finalList.add("key-binding-api-v1")
}
for (module in finalList) {
val mcVersionValue = fabricApiModuleVersions["$module-${version.toPreprocessorNumber()}"] ?: error("No version found for $module-${version.toMCVer()}")
deps.add(OCDependency("net.fabricmc.fabric-api:fabric-$module:$mcVersionValue", true))
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ksp.incremental=false

dgt.java.version=8
dgt.loom.mappings=official-like
dgt.minecraft.revision=4
dgt.minecraft.revision=5

# Project Configuration
project.group=org.polyfrost.oneconfig
Expand Down
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

# Libraries
# All
kotlin = "2.2.10"
kotlin = "2.3.0"
kotlinx-coroutines = "1.10.2"
kotlinx-atomicfu = "0.29.0"
fabric-language-kotlin = "1.13.5+kotlin.2.2.10"
fabric-language-kotlin = "1.13.8+kotlin.2.3.0"
google-ksp = "2.2.10-2.0.2"
polyui = "2.0.7"
annotations = "24.1.0"
Expand All @@ -21,8 +21,8 @@ copycat = "0.1.3"
copycat-image-awt = "0.1.1"

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

# Legacy only
Expand All @@ -35,7 +35,7 @@ brigadier = "1.0.18"
oneconfig-loader = "1.1.0-alpha.48"

# Gradle
dgt = "2.69.0"
dgt = "2.73.0"
kotlinx-abi = "0.18.1"
licenser = "2.1.1"
jetbrains-idea-ext = "1.3"
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
69 changes: 42 additions & 27 deletions minecraft/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.replaymod.gradle.preprocess.PreprocessTask
import com.replaymod.gradle.preprocess.ProjectGraphNode
import com.replaymod.gradle.preprocess.RootPreprocessExtension
import dev.deftu.gradle.utils.GameSide
import dev.deftu.gradle.utils.version.MinecraftDropVersion
import dev.deftu.gradle.utils.version.MinecraftReleaseVersion
import dev.deftu.gradle.utils.version.MinecraftVersions
import gg.essential.gradle.util.RelocationTransform.Companion.registerRelocationAttribute
Expand Down Expand Up @@ -129,7 +130,7 @@ fun DependencyHandlerScope.handleApiDep(dependency: String, isMod: Boolean = fal

fun DependencyHandlerScope.handleApiDep(dependency: ExternalModuleDependency, isMod: Boolean = false) {
val dep = "${dependency.group}:${dependency.name}:${dependency.version}"
if (isMod) "oneConfigModulesCompileOnlyApi"(modApi(dep) {
if (isMod) "oneConfigModulesCompileOnlyApi"(maybeModApi(dep) {
isTransitive = false
attributes {
attribute(includeInLoader, JBoolean.TRUE)
Expand Down Expand Up @@ -167,7 +168,7 @@ dependencies {
)

fun DependencyHandlerScope.compileOnlyCompat(notation: String?) =
notation?.let { modCompileOnly(it) { isTransitive = false } }
notation?.let { maybeModCompileOnly(it) { isTransitive = false } }

fun DependencyHandlerScope.compileOnlyCompat(notation: CompatDependency?) {
when {
Expand All @@ -177,9 +178,14 @@ dependencies {
}
}

val mcVersion = mcData.version as MinecraftReleaseVersion
val tripleVersion = Triple(mcVersion.major, mcVersion.minor, mcVersion.patch)
val mcVersionString = listOf(mcVersion.major, mcVersion.minor, mcVersion.patch).joinToString(".")
val mcVersion = mcData.version
val tripleVersion = when (mcVersion) {
is MinecraftDropVersion -> Triple(mcVersion.year, mcVersion.drop, mcVersion.patch)
is MinecraftReleaseVersion -> Triple(mcVersion.major, mcVersion.minor, mcVersion.patch)
else -> error("no")
}

val mcVersionString = mcData.version.toString()

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


provideIncludedDependencies(
Triple(mcVersion.major, mcVersion.minor, mcVersion.patch),
mcData.loader.friendlyString
tripleVersion,
mcData.loader.friendlyString,
mcVersion.toString()
).forEach {
if (it.dep is String) {
@Suppress("USELESS_CAST")
Expand All @@ -298,7 +305,7 @@ dependencies {
if (mcData.isFabric) {
provideFabricApiDependency(tripleVersion).forEach {
@Suppress("USELESS_CAST")
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}") {
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}") {
isTransitive = false
}
}
Expand Down Expand Up @@ -351,35 +358,43 @@ dependencies {
}
}

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

tasks {
val manifestFunc = { manifest: Manifest ->
val attributesMap = buildMap<String, Any> {
putAll(
mapOf(
"Specification-Title" to modData.id,
"Specification-Vendor" to "Polyfrost",
"Specification-Version" to "1", // We are version 1 of ourselves, whatever the hell that means
"Implementation-Title" to rootProject.name,
"Implementation-Version" to project.version,
"Implementation-Vendor" to "Polyfrost",
"Implementation-Timestamp" to SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date()),
"OneConfig-Main-Class" to "org.polyfrost.oneconfig.internal.bootstrap.Bootstrap",
"MixinConfigs" to "mixins.oneconfigv1.init.json,mixins.oneconfigv1.json",)
)
}
manifest.attributes(attributesMap)
Unit
}

withType(Jar::class) {
exclude("**/**_Test.**")
exclude("**/**_Test$**.**")
}
remapJar {
manifest {
val attributesMap = buildMap<String, Any> {
putAll(
mapOf(
"Specification-Title" to modData.id,
"Specification-Vendor" to "Polyfrost",
"Specification-Version" to "1", // We are version 1 of ourselves, whatever the hell that means
"Implementation-Title" to rootProject.name,
"Implementation-Version" to project.version,
"Implementation-Vendor" to "Polyfrost",
"Implementation-Timestamp" to SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date()),
"OneConfig-Main-Class" to "org.polyfrost.oneconfig.internal.bootstrap.Bootstrap",
"MixinConfigs" to "mixins.oneconfigv1.init.json,mixins.oneconfigv1.json",
)
)
}
attributes(attributesMap)
if (mcData.version.isDrop) {
jar {
manifest(manifestFunc)
}
} else {
named<org.gradle.jvm.tasks.Jar>("remapJar") {
manifest(manifestFunc)
}
}
processResources {
Expand Down
48 changes: 25 additions & 23 deletions minecraft/root.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,31 @@ preprocess {
strictExtraMappings.set(true)
// FOR ALL NEW VERSIONS ENSURE TO UPDATE settings.gradle.kts !

"1.21.11-fabric"(1_21_11, "srg") {
"1.21.11-neoforge"(1_21_11, "srg") {
"1.21.10-neoforge"(1_21_10, "srg") {
"1.21.10-fabric"(1_21_10, "srg") {
"1.21.8-fabric"(1_21_08, "srg") {
"1.21.8-neoforge"(1_21_08, "srg") {
"1.21.5-neoforge"(1_21_05, "srg") {
"1.21.5-fabric"(1_21_05, "srg") {
"1.21.4-fabric"(1_21_04, "srg") {
"1.21.4-neoforge"(1_21_04, "srg") {
"1.21.1-neoforge"(1_21_01, "srg", file("mappings/1.21.4-forge+1.21.1-forge.txt")) {
"1.21.1-fabric"(1_21_01, "srg") {
"1.20.4-fabric"(1_20_04, "srg") {
"1.20.4-neoforge"(1_20_04, "srg") {
"1.20.4-forge"(1_20_04, "srg") {
"1.20.1-forge"(1_20_01, "srg", file("mappings/1.20.4-forge+1.20.1-forge.txt")) {
"1.20.1-fabric"(1_20_01, "srg") {
"1.16.5-fabric"(1_16_05, "srg", file("mappings/1.20.1-fabric+1.16.5-fabric.txt")) {
"1.16.5-forge"(1_16_05, "srg") {
"1.12.2-forge"(1_12_02, "srg", file("mappings/1.16.5-forge+1.12.2-forge.txt")) {
"1.12.2-fabric"(1_12_02, "srg") {
"1.8.9-fabric"(1_08_09, "srg") {
"1.8.9-forge"(1_08_09, "srg")
"26.1-fabric"(26_01_00, "srg") {
"1.21.11-fabric"(1_21_11, "srg") {
"1.21.11-neoforge"(1_21_11, "srg") {
"1.21.10-neoforge"(1_21_10, "srg") {
"1.21.10-fabric"(1_21_10, "srg") {
"1.21.8-fabric"(1_21_08, "srg") {
"1.21.8-neoforge"(1_21_08, "srg") {
"1.21.5-neoforge"(1_21_05, "srg") {
"1.21.5-fabric"(1_21_05, "srg") {
"1.21.4-fabric"(1_21_04, "srg") {
"1.21.4-neoforge"(1_21_04, "srg") {
"1.21.1-neoforge"(1_21_01, "srg", file("mappings/1.21.4-forge+1.21.1-forge.txt")) {
"1.21.1-fabric"(1_21_01, "srg") {
"1.20.4-fabric"(1_20_04, "srg") {
"1.20.4-neoforge"(1_20_04, "srg") {
"1.20.4-forge"(1_20_04, "srg") {
"1.20.1-forge"(1_20_01, "srg", file("mappings/1.20.4-forge+1.20.1-forge.txt")) {
"1.20.1-fabric"(1_20_01, "srg") {
"1.16.5-fabric"(1_16_05, "srg", file("mappings/1.20.1-fabric+1.16.5-fabric.txt")) {
"1.16.5-forge"(1_16_05, "srg") {
"1.12.2-forge"(1_12_02, "srg", file("mappings/1.16.5-forge+1.12.2-forge.txt")) {
"1.12.2-fabric"(1_12_02, "srg") {
"1.8.9-fabric"(1_08_09, "srg") {
"1.8.9-forge"(1_08_09, "srg")
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion minecraft/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"depends": {
"fabricloader": ">=0.12.0",
"minecraft": "${mc_version}"
"minecraft": "${fabric_mc_version}"
},
"custom": {
"modmenu": {
Expand Down
Loading
Loading