Skip to content

Commit

Permalink
improve debug logs and untangle ifs
Browse files Browse the repository at this point in the history
  • Loading branch information
chochem committed Sep 26, 2024
1 parent 05877d2 commit 92df778
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
22 changes: 17 additions & 5 deletions src/main/java/gregtech/api/enums/OrePrefixes.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1309,20 +1310,31 @@ 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
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/gregtech/api/util/GTRecipeBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 92df778

Please sign in to comment.