From 448d2a9dfe6fef996d526e13ea93379810efa784 Mon Sep 17 00:00:00 2001 From: rlnt Date: Thu, 22 Aug 2024 22:25:42 +0200 Subject: [PATCH] rename strict mode to compare all --- .../unified/config/DuplicateConfig.java | 18 +++++++++--------- .../unification/recipe/RecipeTransformer.java | 2 +- testmod_configs/duplicates.json | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Common/src/main/java/com/almostreliable/unified/config/DuplicateConfig.java b/Common/src/main/java/com/almostreliable/unified/config/DuplicateConfig.java index 37be58d..383d6d7 100644 --- a/Common/src/main/java/com/almostreliable/unified/config/DuplicateConfig.java +++ b/Common/src/main/java/com/almostreliable/unified/config/DuplicateConfig.java @@ -19,17 +19,17 @@ public final class DuplicateConfig extends Config { private final LinkedHashMap overrideRules; private final Set ignoreRecipeTypes; private final Set ignoreRecipeIds; - private final boolean strictMode; + private final boolean compareAll; private final Map ignoredRecipeTypesCache; - private DuplicateConfig(JsonCompare.CompareSettings defaultRules, LinkedHashMap overrideRules, Set ignoreRecipeTypes, Set ignoreRecipeIds, boolean strictMode) { + private DuplicateConfig(JsonCompare.CompareSettings defaultRules, LinkedHashMap overrideRules, Set ignoreRecipeTypes, Set ignoreRecipeIds, boolean compareAll) { super(NAME); this.defaultRules = defaultRules; this.overrideRules = overrideRules; this.ignoreRecipeTypes = ignoreRecipeTypes; this.ignoreRecipeIds = ignoreRecipeIds; - this.strictMode = strictMode; + this.compareAll = compareAll; this.ignoredRecipeTypesCache = new HashMap<>(); } @@ -68,8 +68,8 @@ public final class DuplicateConfig extends Config { return overrideRules.getOrDefault(type, defaultRules); } - public boolean isStrictMode() { - return strictMode; + public boolean shouldCompareAll() { + return compareAll; } public void clearCache() { @@ -82,7 +82,7 @@ public final class DuplicateConfig extends Config { private static final String OVERRIDE_DUPLICATE_RULES = "override_duplicate_rules"; private static final String IGNORED_RECIPE_TYPES = "ignored_recipe_types"; private static final String IGNORED_RECIPE_IDS = "ignored_recipe_ids"; - private static final String STRICT_MODE = "strict_mode"; + private static final String COMPARE_ALL = "compare_all"; private DuplicateSerializer() {} @@ -101,14 +101,14 @@ public final class DuplicateConfig extends Config { Defaults.getDefaultDuplicateRules(platform)); LinkedHashMap overrideRules = safeGet(() -> getOverrideRules( json), Defaults.getDefaultDuplicateOverrides(platform)); - boolean strictMode = safeGet(() -> json.get(STRICT_MODE).getAsBoolean(), false); + boolean compareAll = safeGet(() -> json.get(COMPARE_ALL).getAsBoolean(), false); return new DuplicateConfig( defaultRules, overrideRules, ignoreRecipeTypes, ignoreRecipeIds, - strictMode + compareAll ); } @@ -142,7 +142,7 @@ public final class DuplicateConfig extends Config { config.overrideRules.forEach((rl, compareSettings) -> overrides.add(rl.toString(), compareSettings.serialize())); json.add(OVERRIDE_DUPLICATE_RULES, overrides); - json.addProperty(STRICT_MODE, false); + json.addProperty(COMPARE_ALL, false); return json; } diff --git a/Common/src/main/java/com/almostreliable/unified/unification/recipe/RecipeTransformer.java b/Common/src/main/java/com/almostreliable/unified/unification/recipe/RecipeTransformer.java index 519ed4f..f348015 100644 --- a/Common/src/main/java/com/almostreliable/unified/unification/recipe/RecipeTransformer.java +++ b/Common/src/main/java/com/almostreliable/unified/unification/recipe/RecipeTransformer.java @@ -86,7 +86,7 @@ public class RecipeTransformer { */ private void transformRecipes(List recipeLinks, Map allRecipes, @Nullable ClientRecipeTracker.RawBuilder tracker) { var unified = unifyRecipes(recipeLinks, r -> allRecipes.put(r.getId(), r.getUnified())); - var duplicates = handleDuplicates(duplicateConfig.isStrictMode() ? recipeLinks : unified, recipeLinks); + var duplicates = handleDuplicates(duplicateConfig.shouldCompareAll() ? recipeLinks : unified, recipeLinks); duplicates .stream() .flatMap(d -> d.getRecipesWithoutMaster().stream()) diff --git a/testmod_configs/duplicates.json b/testmod_configs/duplicates.json index 1bd2443..b27864e 100644 --- a/testmod_configs/duplicates.json +++ b/testmod_configs/duplicates.json @@ -31,5 +31,5 @@ "should_sanitize": false } }, - "strict_mode": false + "compare_all": false }