diff --git a/src/main/java/gregtech/api/util/GTModHandler.java b/src/main/java/gregtech/api/util/GTModHandler.java index 009cde64760..fa56ab9b34e 100644 --- a/src/main/java/gregtech/api/util/GTModHandler.java +++ b/src/main/java/gregtech/api/util/GTModHandler.java @@ -482,12 +482,26 @@ public static boolean addScrapboxDrop(float aChance, ItemStack aOutput) { return true; } + // temporary buffer list to fix NPE if you try to access the recyclerBlacklist too early + private static List tempRecyclerBlackList = new ArrayList<>(); + /** * Adds an Item to the Recycler Blacklist */ public static boolean addToRecyclerBlackList(ItemStack aRecycledStack) { if (aRecycledStack == null) return false; - Recipes.recyclerBlacklist.add(new RecipeInputItemStack(aRecycledStack)); + final RecipeInputItemStack iRecipeInput = new RecipeInputItemStack(aRecycledStack); + if (Recipes.recyclerBlacklist == null) { + tempRecyclerBlackList.add(iRecipeInput); + return true; + } + if (tempRecyclerBlackList != null) { + for (RecipeInputItemStack recipe : tempRecyclerBlackList) { + Recipes.recyclerBlacklist.add(recipe); + } + tempRecyclerBlackList = null; + } + Recipes.recyclerBlacklist.add(iRecipeInput); return true; } diff --git a/src/main/java/gregtech/common/GTProxy.java b/src/main/java/gregtech/common/GTProxy.java index e7cb627c91b..8b2c1535919 100644 --- a/src/main/java/gregtech/common/GTProxy.java +++ b/src/main/java/gregtech/common/GTProxy.java @@ -814,22 +814,15 @@ public GTProxy() { .getRegisteredFluidContainerData()) { onFluidContainerRegistration(new FluidContainerRegistry.FluidContainerRegisterEvent(tData)); } - try { - for (String tOreName : OreDictionary.getOreNames()) { - ItemStack tOreStack; - for (Iterator i$ = OreDictionary.getOres(tOreName) - .iterator(); i$.hasNext(); registerOre(new OreDictionary.OreRegisterEvent(tOreName, tOreStack))) { - tOreStack = i$.next(); - } + for (String tOreName : OreDictionary.getOreNames()) { + for (ItemStack itemStack : OreDictionary.getOres(tOreName)) { + registerOre(new OreDictionary.OreRegisterEvent(tOreName, itemStack)); } - } catch (Throwable e) { - e.printStackTrace(GTLog.err); } } public void onPreLoad() { GTLog.out.println("GTMod: Preload-Phase started!"); - GTLog.ore.println("GTMod: Preload-Phase started!"); GregTechAPI.sPreloadStarted = true; this.mIgnoreTcon = OPStuff.ignoreTinkerConstruct;