From c333c46bf33ec2953af8148384c5519d04a4561c Mon Sep 17 00:00:00 2001 From: chochem <40274384+chochem@users.noreply.github.com> Date: Thu, 26 Sep 2024 15:50:32 +0100 Subject: [PATCH] Improve a new debug log (#3286) --- .../java/gregtech/api/enums/OrePrefixes.java | 23 +++++++++++++++---- .../gregtech/api/util/GTRecipeBuilder.java | 2 +- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/main/java/gregtech/api/enums/OrePrefixes.java b/src/main/java/gregtech/api/enums/OrePrefixes.java index 27cf37a2de3..08dd2b77926 100644 --- a/src/main/java/gregtech/api/enums/OrePrefixes.java +++ b/src/main/java/gregtech/api/enums/OrePrefixes.java @@ -3,6 +3,7 @@ import static gregtech.api.enums.GTValues.B; import static gregtech.api.enums.GTValues.D2; import static gregtech.api.enums.GTValues.M; +import static gregtech.api.util.GTRecipeBuilder.DEBUG_MODE_COLLISION; import java.util.ArrayList; import java.util.Arrays; @@ -1309,20 +1310,32 @@ public void processOre(Materials aMaterial, String aOreDictName, String aModName return; } - if (aMaterial != Materials._NULL && !used.add(aMaterial)) { - GTLog.out.println("Duplicate material registry attempted by " + aModName + " for " + aOreDictName); + if (aMaterial.contains(SubTag.NO_RECIPES)) { return; } - if (aMaterial.contains(SubTag.NO_RECIPES)) { + if (aMaterial == Materials._NULL && !mIsSelfReferencing && mIsMaterialBased) { return; } - if (!((aMaterial != Materials._NULL || mIsSelfReferencing || !mIsMaterialBased) - && GTUtility.isStackValid(aStack))) { + if (!GTUtility.isStackValid(aStack)) { return; } + if (aMaterial != Materials._NULL) { + if (!used.add(aMaterial)) { + if (DEBUG_MODE_COLLISION) { + GTLog.out + .println("Attempted duplicate recipe registration by " + aModName + " for " + aOreDictName); + } + return; + } else { + if (DEBUG_MODE_COLLISION) { + GTLog.out.println("New recipe registration by " + aModName + " for " + aOreDictName); + } + } + } + for (IOreRecipeRegistrator tRegistrator : mOreProcessing) { if (D2) GTLog.ore.println( "Processing '" + aOreDictName diff --git a/src/main/java/gregtech/api/util/GTRecipeBuilder.java b/src/main/java/gregtech/api/util/GTRecipeBuilder.java index 69890e564df..f93f8b38c81 100644 --- a/src/main/java/gregtech/api/util/GTRecipeBuilder.java +++ b/src/main/java/gregtech/api/util/GTRecipeBuilder.java @@ -43,7 +43,7 @@ public class GTRecipeBuilder { private static final boolean DEBUG_MODE_FULL_ENERGY; // Any stable release should be tested at least once with this: -Dgt.recipebuilder.panic.invalid=true private static final boolean PANIC_MODE_INVALID; - private static final boolean DEBUG_MODE_COLLISION; + public static final boolean DEBUG_MODE_COLLISION; // Any stable release should be tested at least once with this: -Dgt.recipebuilder.panic.collision=true private static final boolean PANIC_MODE_COLLISION;