From 41d19e692240f73b8d897bb047b85d9d604a47a2 Mon Sep 17 00:00:00 2001 From: Emma Triphora Date: Tue, 14 Nov 2023 18:18:34 -0500 Subject: [PATCH] Support NeoForge userdev plugin Closes #59 --- build.gradle | 2 +- .../modrinth/minotaur/TaskModrinthUpload.java | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index 7bedb18..1d832fa 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ plugins { id 'com.gradle.plugin-publish' version '1.2.0' } -version = '2.8.4' +version = '2.8.5' group = 'com.modrinth.minotaur' archivesBaseName = 'Minotaur' description = 'Modrinth plugin for publishing builds to the website!' diff --git a/src/main/java/com/modrinth/minotaur/TaskModrinthUpload.java b/src/main/java/com/modrinth/minotaur/TaskModrinthUpload.java index ed279b4..e1d1010 100644 --- a/src/main/java/com/modrinth/minotaur/TaskModrinthUpload.java +++ b/src/main/java/com/modrinth/minotaur/TaskModrinthUpload.java @@ -107,6 +107,7 @@ public void apply() { Map pluginLoaderMap = new HashMap<>(); pluginLoaderMap.put("net.minecraftforge.gradle", "forge"); pluginLoaderMap.put("net.neoforged.gradle", "neoforge"); + pluginLoaderMap.put("net.neoforged.gradle.userdev", "neoforge"); pluginLoaderMap.put("org.quiltmc.loom", "quilt"); pluginLoaderMap.put("org.spongepowered.gradle.plugin", "sponge"); pluginLoaderMap.put("io.papermc.paperweight.userdev", "paper"); @@ -141,14 +142,18 @@ && getProject().getExtensions().findByName("loom") != null) { // Attempt to automatically resolve the game version if none were specified. if (ext.getGameVersions().get().isEmpty()) { if (pluginManager.hasPlugin("net.minecraftforge.gradle") || - pluginManager.hasPlugin("net.neoforged.gradle")) { - // ForgeGradle will store the game version here. - // https://github.com/MinecraftForge/ForgeGradle/blob/FG_5.0/src/userdev/java/net/minecraftforge/gradle/userdev/MinecraftUserRepo.java#L199 - String version = (String) getProject().getExtensions().getExtraProperties().get("MC_VERSION"); + pluginManager.hasPlugin("net.neoforged.gradle") || + pluginManager.hasPlugin("net.neoforged.gradle.userdev")) { - if (version != null) { - getLogger().debug("Adding fallback game version {} from ForgeGradle/NeoGradle.", version); - add(ext.getGameVersions(), version); + String[] props = {"MC_VERSION", "minecraftVersion"}; + + for (String prop : props) { + String version = (String) getProject().getExtensions().getExtraProperties().get(prop); + if (version != null) { + getLogger().debug("Adding fallback game version {} from ForgeGradle/NeoGradle.", version); + add(ext.getGameVersions(), version); + break; + } } }