From 507bce87e378f5c0afd3b619c52f8aa4c9f56501 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Tue, 1 Oct 2024 13:23:46 +0200 Subject: [PATCH] add setting to enable more debug logging when failing to generate certain ore processing recipes --- .../oreprocessing/DiagramBuilder.java | 28 +++++++++++-------- .../oreprocessing/RecipeHandler.java | 1 - .../main/config/ConfigOptions.java | 8 +++++- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/github/dcysteine/neicustomdiagram/generators/gregtech5/oreprocessing/DiagramBuilder.java b/src/main/java/com/github/dcysteine/neicustomdiagram/generators/gregtech5/oreprocessing/DiagramBuilder.java index 45928f7..6239db5 100644 --- a/src/main/java/com/github/dcysteine/neicustomdiagram/generators/gregtech5/oreprocessing/DiagramBuilder.java +++ b/src/main/java/com/github/dcysteine/neicustomdiagram/generators/gregtech5/oreprocessing/DiagramBuilder.java @@ -22,6 +22,7 @@ import com.github.dcysteine.neicustomdiagram.api.diagram.tooltip.Tooltip; import com.github.dcysteine.neicustomdiagram.api.draw.Point; import com.github.dcysteine.neicustomdiagram.main.Logger; +import com.github.dcysteine.neicustomdiagram.main.config.ConfigOptions; import com.github.dcysteine.neicustomdiagram.util.ComponentTransformer; import com.github.dcysteine.neicustomdiagram.util.gregtech5.GregTechFluidDictUtil; import com.github.dcysteine.neicustomdiagram.util.gregtech5.GregTechOreDictUtil; @@ -146,19 +147,24 @@ void buildDiagram(ComponentDiagramMatcher.Builder matcherBuilder) { centrifugedOreOptional = Optional.empty(); } } else { - Logger.GREGTECH_5_ORE_PROCESSING.warn( - "Crushed ore and purified ore have different thermal centrifuge outputs:" - + "\n[{}]\n ->\n[{}]\n\n[{}]\n ->\n[{}]", - crushedOre, - crushedOreOutputs, - purifiedOre, - purifiedOreOutputs); + if (ConfigOptions.OREPROC_DEBUG_LOGGING.get()) { + Logger.GREGTECH_5_ORE_PROCESSING.warn( + "Crushed ore and purified ore have different thermal centrifuge outputs:" + + "\n[{}]\n ->\n[{}]\n\n[{}]\n ->\n[{}]", + crushedOre, + crushedOreOutputs, + purifiedOre, + purifiedOreOutputs); + } else { + Logger.GREGTECH_5_ORE_PROCESSING + .warn("Crushed and purified [{}] have different thermal centrifuge outputs.", crushedOre); + } centrifugedOreOptional = Optional.empty(); } } else { centrifugedOreOptional = crushedOreOptional.flatMap(crushedOre -> { Logger.GREGTECH_5_ORE_PROCESSING.warn( - "Crushed ore had thermal centrifuge recipe," + " but no ore washing plant recipe: [{}]", + "Crushed ore had thermal centrifuge recipe, but no ore washing plant recipe: [{}]", crushedOre); return handleRecipes( RecipeHandler.RecipeMap.THERMAL_CENTRIFUGE, @@ -306,9 +312,8 @@ private Optional handleRecipes(RecipeHandler.RecipeMap recipeMap, List outputs = new ArrayList<>(outputsOptional.get()); ComponentTransformer.removeComponent(outputs, STONE_DUST); - if (outputs.size() == 0) { + if (outputs.isEmpty()) { Logger.GREGTECH_5_ORE_PROCESSING.warn("Found no recipe outputs: [{}] [{}]", key, input); - return Optional.empty(); } diagramBuilder.autoInsertIntoSlotGroup(key).insertEachSafe(outputs); @@ -339,9 +344,8 @@ private void handleChemicalBathFluid(RecipeHandler.ChemicalBathFluid chemicalBat List outputs = new ArrayList<>(recipeOptional.get().outputs()); ComponentTransformer.removeComponent(outputs, STONE_DUST); - if (outputs.size() == 0) { + if (outputs.isEmpty()) { Logger.GREGTECH_5_ORE_PROCESSING.warn("Found no recipe outputs: [{}] [{}]", key, input); - return; } diagramBuilder.autoInsertIntoSlotGroup(key).insertIntoNextSlot(fluidDisplayItem.orElse(fluid)) diff --git a/src/main/java/com/github/dcysteine/neicustomdiagram/generators/gregtech5/oreprocessing/RecipeHandler.java b/src/main/java/com/github/dcysteine/neicustomdiagram/generators/gregtech5/oreprocessing/RecipeHandler.java index 1292cb5..d2ce7e5 100644 --- a/src/main/java/com/github/dcysteine/neicustomdiagram/generators/gregtech5/oreprocessing/RecipeHandler.java +++ b/src/main/java/com/github/dcysteine/neicustomdiagram/generators/gregtech5/oreprocessing/RecipeHandler.java @@ -215,7 +215,6 @@ Optional> getUniqueRecipeOutput(RecipeMap recipe if (outputs.size() > 1) { Logger.GREGTECH_5_ORE_PROCESSING.warn("Found {} recipes: [{}] [{}]", outputs.size(), recipeMap, input); - return Optional.empty(); } else if (outputs.isEmpty()) { return Optional.empty(); diff --git a/src/main/java/com/github/dcysteine/neicustomdiagram/main/config/ConfigOptions.java b/src/main/java/com/github/dcysteine/neicustomdiagram/main/config/ConfigOptions.java index cb6073f..7e49a12 100644 --- a/src/main/java/com/github/dcysteine/neicustomdiagram/main/config/ConfigOptions.java +++ b/src/main/java/com/github/dcysteine/neicustomdiagram/main/config/ConfigOptions.java @@ -100,7 +100,7 @@ public final class ConfigOptions { Category.OPTIONS, "tooltip_max_cycle_count", 8, - "Sets the maximum # of cycle components that will be shown in a tooltip" + " when is held." + "Sets the maximum # of cycle components that will be shown in a tooltip when is held." + "\nSet to 0 to disable this feature.").register(); public static final Option NBT_VIEWER_SMALL_TEXT = new BooleanOption( @@ -115,6 +115,12 @@ public final class ConfigOptions { false, "Enables drawing values on a separate line in the NBT Viewer diagram.").register(); + public static final Option OREPROC_DEBUG_LOGGING = new BooleanOption( + Category.OPTIONS, + "oreproc_debug_logging", + false, + "Enables more debug logging when failing to generate diagram for certain ore processing steps").register(); + public enum Category { OPTIONS("options"),