From 0fcf7a75e451cae403186138b569a8e69f2b0ce6 Mon Sep 17 00:00:00 2001 From: RedNesto Date: Sat, 10 Aug 2024 00:36:26 +0200 Subject: [PATCH] Fix NeoForge versions not matching major mc release correctly --- changelog.md | 1 + .../kotlin/platform/neoforge/version/NeoForgeVersion.kt | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 4c90b300f..a1f6fa927 100644 --- a/changelog.md +++ b/changelog.md @@ -28,6 +28,7 @@ - [#2282](https://github.com/minecraft-dev/MinecraftDev/issues/2282) Mixin support confusion with `$` and `.` separators in class names - Recent NeoModDev version import errors - Recommended Artifact ID value was not sanitized properly +- NeoForge versions in the Architectury were not being matched correctly for the first version of a major Minecraft release ## [1.8.0] diff --git a/src/main/kotlin/platform/neoforge/version/NeoForgeVersion.kt b/src/main/kotlin/platform/neoforge/version/NeoForgeVersion.kt index e1b6427be..ad8aafb4d 100644 --- a/src/main/kotlin/platform/neoforge/version/NeoForgeVersion.kt +++ b/src/main/kotlin/platform/neoforge/version/NeoForgeVersion.kt @@ -48,7 +48,11 @@ class NeoForgeVersion private constructor(val versions: List) { fun getNeoForgeVersions(mcVersion: SemanticVersion): List { val versionText = mcVersion.toString() // Drop the 1. part of the mc version - val shortMcVersion = versionText.substringAfter('.') + var shortMcVersion = versionText.substringAfter('.') + if (!shortMcVersion.contains('.')) { + // Ensure we have the .0 part + shortMcVersion = "$shortMcVersion.0" + } val toList = versions.asSequence() .filter { it.substringBeforeLast('.') == shortMcVersion } .mapNotNull(SemanticVersion::tryParse)