Skip to content

Commit

Permalink
Merge branch 'master' into asm-rework
Browse files Browse the repository at this point in the history
  • Loading branch information
Dream-Master authored Sep 21, 2024
2 parents 7982c76 + 00f1db6 commit 9df810c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/main/java/gregtech/api/enums/OrePrefixes.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import com.google.common.collect.ImmutableList;

import gregtech.api.GregTechAPI;
import gregtech.api.enums.TCAspects.TC_AspectStack;
import gregtech.api.interfaces.ICondition;
import gregtech.api.interfaces.IOreRecipeRegistrator;
Expand Down Expand Up @@ -1179,6 +1180,8 @@ public enum OrePrefixes {
} else if (name().startsWith("battery")) {
new TC_AspectStack(TCAspects.ELECTRUM, 1).addToAspectList(mAspects);
}

GregTechAPI.sGTCompleteLoad.add(this::onLoadComplete);
}

public static boolean isInstanceOf(String aName, OrePrefixes aPrefix) {
Expand Down Expand Up @@ -1297,12 +1300,20 @@ public boolean add(IOreRecipeRegistrator aRegistrator) {
return mOreProcessing.add(aRegistrator);
}

// Hack to prevent duplicate registry of oredicted materials
HashSet<Materials> used = new HashSet<>();

public void processOre(Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) {

if (aMaterial == null) {
return;
}

if (aMaterial != Materials._NULL && !used.add(aMaterial)) {
GTLog.out.println("Duplicate material registry attempted by " + aModName + " for " + aOreDictName);
return;
}

if (aMaterial.contains(SubTag.NO_RECIPES)) {
return;
}
Expand All @@ -1325,6 +1336,10 @@ public void processOre(Materials aMaterial, String aOreDictName, String aModName
}
}

public void onLoadComplete() {
used = null;
}

public Object get(Object aMaterial) {
if (aMaterial instanceof Materials) return new ItemData(this, (Materials) aMaterial);
return name() + aMaterial;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import static gregtech.api.util.GTRecipeBuilder.TICKS;
import static gregtech.api.util.GTRecipeBuilder.WILDCARD;
import static gregtech.api.util.GTRecipeConstants.ADDITIVE_AMOUNT;
import static gregtech.api.util.GTRecipeConstants.COMPRESSION_TIER;
import static gregtech.api.util.GTRecipeConstants.FUEL_TYPE;
import static gregtech.api.util.GTRecipeConstants.FUEL_VALUE;
import static gregtech.api.util.GTUtility.calculateRecipeEU;
Expand Down

0 comments on commit 9df810c

Please sign in to comment.