diff --git a/neoform/src/main/java/net/neoforged/gradle/neoform/runtime/specification/NeoFormRuntimeSpecification.java b/neoform/src/main/java/net/neoforged/gradle/neoform/runtime/specification/NeoFormRuntimeSpecification.java index 420ed0fc3..4e82a81e3 100644 --- a/neoform/src/main/java/net/neoforged/gradle/neoform/runtime/specification/NeoFormRuntimeSpecification.java +++ b/neoform/src/main/java/net/neoforged/gradle/neoform/runtime/specification/NeoFormRuntimeSpecification.java @@ -54,7 +54,12 @@ public String getMinecraftVersion() { } public String getNeoFormVersion() { - return getVersion().substring(getVersion().lastIndexOf("-") + 1); + String prefix = getMinecraftVersion() + "-"; + if (getVersion().startsWith(prefix)) { + return getVersion().substring(prefix.length()); + } else { + throw new RuntimeException("NeoForm version " + getVersion() + " does not start with Minecraft version" + getMinecraftVersion()); + } } public File getNeoFormArchive() {