From 6427f8043dc03e291e9feb9eee1b010f747611ca Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Tue, 23 Jul 2024 22:46:01 +0200 Subject: [PATCH] fix: allow neoforge declaration without modid --- CHANGELOG.md | 4 ++++ .../src/main/kotlin/NeoForgeExtension.kt | 24 ++++++++++--------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 99497c3..f2a0d5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed + +- Declaring `neoForge()` without a `modId` set will not create a mod or run configs. Can be used for a NeoForge library module. + ## [0.16.7] - 2024-07-20 ### Fixed diff --git a/refinedarchitect-plugin/src/main/kotlin/NeoForgeExtension.kt b/refinedarchitect-plugin/src/main/kotlin/NeoForgeExtension.kt index a5a124f..f4e1a7a 100644 --- a/refinedarchitect-plugin/src/main/kotlin/NeoForgeExtension.kt +++ b/refinedarchitect-plugin/src/main/kotlin/NeoForgeExtension.kt @@ -15,18 +15,20 @@ open class NeoForgeExtension(private val project: Project) : BaseExtension(proje project.extensions.getByType().apply { version.set(neoForgeVersion) addModdingDependenciesTo(sourceSets["test"]) - mods { - register(modId!!) { - modSourceSets.set(listOf(sourceSets["main"], sourceSets["test"])) - } - } - runs { - register("client") { - client() + if (modId != null) { + mods { + register(modId!!) { + modSourceSets.set(listOf(sourceSets["main"], sourceSets["test"])) + } } - register("server") { - server() - programArgument("--nogui") + runs { + register("client") { + client() + } + register("server") { + server() + programArgument("--nogui") + } } } parchment {