From 0072bf456d40243eabd2a9808914ba7aeefb9c20 Mon Sep 17 00:00:00 2001 From: rlnt Date: Tue, 3 Sep 2024 15:44:46 +0200 Subject: [PATCH] fix minecraft version not being overridden by recipe viewers --- CHANGELOG.md | 3 ++- .../almostgradle/dependency/RecipeViewerOptions.java | 10 ++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bbdd55..5daf012 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog], and this project adheres to [Semantic Versioning]. ## Unreleased -- / + +- fixed `minecraftVersion` not being overridden by recipe viewer configs ## [1.0.0] - 2024-09-01 diff --git a/src/main/java/com/almostreliable/almostgradle/dependency/RecipeViewerOptions.java b/src/main/java/com/almostreliable/almostgradle/dependency/RecipeViewerOptions.java index 655a3bb..343c59d 100644 --- a/src/main/java/com/almostreliable/almostgradle/dependency/RecipeViewerOptions.java +++ b/src/main/java/com/almostreliable/almostgradle/dependency/RecipeViewerOptions.java @@ -49,15 +49,13 @@ public RecipeViewerOptions(Project project, ModDependency mod) { public Provider getDependency() { var almostGradle = project.getExtensions().getByType(AlmostGradleExtension.class); - return getVersion().map(v -> mod.createDependency(almostGradle.getMinecraftVersion(), - v, - project.getDependencyFactory())); + var mcv = getMinecraftVersion().orElse(almostGradle.getMinecraftVersion()).get(); + return getVersion().map(v -> mod.createDependency(mcv, v, project.getDependencyFactory())); } public Provider getApiDependency() { var almostGradle = project.getExtensions().getByType(AlmostGradleExtension.class); - return getVersion().map(v -> mod.createApiDependency(almostGradle.getMinecraftVersion(), - v, - project.getDependencyFactory())); + var mcv = getMinecraftVersion().orElse(almostGradle.getMinecraftVersion()).get(); + return getVersion().map(v -> mod.createApiDependency(mcv, v, project.getDependencyFactory())); } }