Skip to content

Commit

Permalink
add setting to enable more debug logging when failing to generate cer…
Browse files Browse the repository at this point in the history
…tain ore processing recipes (#40)
  • Loading branch information
Alexdoru authored Oct 2, 2024
1 parent 5043f73 commit dfa9129
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -306,9 +312,8 @@ private Optional<ItemComponent> handleRecipes(RecipeHandler.RecipeMap recipeMap,

List<DisplayComponent> 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);
Expand Down Expand Up @@ -339,9 +344,8 @@ private void handleChemicalBathFluid(RecipeHandler.ChemicalBathFluid chemicalBat

List<DisplayComponent> 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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ Optional<ImmutableList<DisplayComponent>> 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <Shift> is held."
"Sets the maximum # of cycle components that will be shown in a tooltip when <Shift> is held."
+ "\nSet to 0 to disable this feature.").register();

public static final Option<Boolean> NBT_VIEWER_SMALL_TEXT = new BooleanOption(
Expand All @@ -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<Boolean> 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"),
Expand Down

0 comments on commit dfa9129

Please sign in to comment.