User: rednesto Date: 05 Oct 24 11:18 Revision: f5ea374e402abb6524e196d3c18d4ab368599c98 Summary: Fix #2385 Support ModDevGradle Vanilla-Mode TeamCity URL: https://ci.mcdev.io/viewModification.html?tab=vcsModificationFiles&modId=9765&personal=false Index: changelog.md =================================================================== --- changelog.md (revision e97dfd5800096266117087269a610eb4ee2a7490) +++ changelog.md (revision f5ea374e402abb6524e196d3c18d4ab368599c98) @@ -13,6 +13,7 @@ - Mixin injection signature fix preview - Loom 1.8 support - K2 mode compatibility +- [#2385](https://github.com/minecraft-dev/MinecraftDev/issues/2385) ModDevGradle Vanilla-Mode support ### Changed Index: src/gradle-tooling-extension/groovy/com/demonwav/mcdev/platform/mcp/gradle/tooling/neomoddev/NeoModDevGradleModelBuilderImpl.groovy =================================================================== --- src/gradle-tooling-extension/groovy/com/demonwav/mcdev/platform/mcp/gradle/tooling/neomoddev/NeoModDevGradleModelBuilderImpl.groovy (revision e97dfd5800096266117087269a610eb4ee2a7490) +++ src/gradle-tooling-extension/groovy/com/demonwav/mcdev/platform/mcp/gradle/tooling/neomoddev/NeoModDevGradleModelBuilderImpl.groovy (revision f5ea374e402abb6524e196d3c18d4ab368599c98) @@ -47,10 +47,8 @@ return null } - def neoforgeVersion = extension.version.get() - if (neoforgeVersion == null) { - return null - } + def neoforgeVersion = extension.version.getOrNull() + def neoFormVersion = extension.neoFormVersion.getOrNull() def accessTransformersRaw = extension.accessTransformers List accessTransformers @@ -74,7 +72,7 @@ } //noinspection GroovyAssignabilityCheck - return new NeoModDevGradleModelImpl(neoforgeVersion, mappingsFile, accessTransformers) + return new NeoModDevGradleModelImpl(neoforgeVersion, neoFormVersion, mappingsFile, accessTransformers) } @Override Index: src/gradle-tooling-extension/groovy/com/demonwav/mcdev/platform/mcp/gradle/tooling/neomoddev/NeoModDevGradleModelImpl.groovy =================================================================== --- src/gradle-tooling-extension/groovy/com/demonwav/mcdev/platform/mcp/gradle/tooling/neomoddev/NeoModDevGradleModelImpl.groovy (revision e97dfd5800096266117087269a610eb4ee2a7490) +++ src/gradle-tooling-extension/groovy/com/demonwav/mcdev/platform/mcp/gradle/tooling/neomoddev/NeoModDevGradleModelImpl.groovy (revision f5ea374e402abb6524e196d3c18d4ab368599c98) @@ -20,24 +20,14 @@ package com.demonwav.mcdev.platform.mcp.gradle.tooling.neomoddev - import com.demonwav.mcdev.platform.mcp.gradle.tooling.McpModelNMD -import groovy.transform.CompileStatic +import groovy.transform.Immutable -@CompileStatic +@Immutable(knownImmutableClasses = [File]) final class NeoModDevGradleModelImpl implements McpModelNMD, Serializable { final String neoForgeVersion + final String neoFormVersion final File mappingsFile final List accessTransformers - - NeoModDevGradleModelImpl( - final String neoForgeVersion, - final File mappingsFile, - final List accessTransformers - ) { - this.neoForgeVersion = neoForgeVersion - this.mappingsFile = mappingsFile - this.accessTransformers = accessTransformers - } +} -} Index: src/gradle-tooling-extension/java/com/demonwav/mcdev/platform/mcp/gradle/tooling/McpModelNMD.java =================================================================== --- src/gradle-tooling-extension/java/com/demonwav/mcdev/platform/mcp/gradle/tooling/McpModelNMD.java (revision e97dfd5800096266117087269a610eb4ee2a7490) +++ src/gradle-tooling-extension/java/com/demonwav/mcdev/platform/mcp/gradle/tooling/McpModelNMD.java (revision f5ea374e402abb6524e196d3c18d4ab368599c98) @@ -20,11 +20,14 @@ package com.demonwav.mcdev.platform.mcp.gradle.tooling; +import org.jetbrains.annotations.Nullable; + import java.io.File; import java.util.List; public interface McpModelNMD { - String getNeoForgeVersion(); + @Nullable String getNeoForgeVersion(); + @Nullable String getNeoFormVersion(); File getMappingsFile(); List getAccessTransformers(); } Index: src/main/kotlin/platform/mcp/gradle/datahandler/McpModelNMDHandler.kt =================================================================== --- src/main/kotlin/platform/mcp/gradle/datahandler/McpModelNMDHandler.kt (revision e97dfd5800096266117087269a610eb4ee2a7490) +++ src/main/kotlin/platform/mcp/gradle/datahandler/McpModelNMDHandler.kt (revision f5ea374e402abb6524e196d3c18d4ab368599c98) @@ -44,8 +44,14 @@ ) { val data = resolverCtx.getExtraProject(gradleModule, McpModelNMD::class.java) ?: return + val minecraftVersion = when { + data.neoForgeVersion != null -> "1." + data.neoForgeVersion!!.substringBeforeLast('.').removeSuffix(".0") + data.neoFormVersion != null -> data.neoFormVersion!!.substringBeforeLast('-').removeSuffix(".0") + else -> null + } + val state = McpModuleSettings.State( - "1." + data.neoForgeVersion.substringBeforeLast('.').removeSuffix(".0"), + minecraftVersion, null, data.mappingsFile?.absolutePath, SrgType.TSRG,