From 4f73acc83a6e7c051efa4393d3734155c287c669 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Fri, 31 Aug 2018 04:23:47 +0200 Subject: added config option to allow broken recipe map for debug purposes --- src/main/java/gregtech/GT_Mod.java | 2 ++ src/main/java/gregtech/api/enums/GT_Values.java | 5 +++++ src/main/java/gregtech/api/util/GT_Recipe.java | 27 ++++++++++++++++++++++--- 3 files changed, 31 insertions(+), 3 deletions(-) (limited to 'src/main/java/gregtech') diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index 9798dc2d7e..2a3dffc3ce 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -226,8 +226,10 @@ public class GT_Mod implements IGT_Mod { gregtechproxy.onPreLoad(); GT_Log.out.println("GT_Mod: Setting Configs"); + GT_Values.D1 = tMainConfig.get(aTextGeneral, "Debug", false).getBoolean(false); GT_Values.D2 = tMainConfig.get(aTextGeneral, "Debug2", false).getBoolean(false); + GT_Values.allow_broken_recipemap = tMainConfig.get(aTextGeneral, "debug allow broken recipemap",false).getBoolean(false); GT_Values.debugCleanroom = tMainConfig.get(aTextGeneral, "debugCleanroom", false).getBoolean(false); GT_Values.debugDriller = tMainConfig.get(aTextGeneral, "debugDriller", false).getBoolean(false); GT_Values.debugWorldGen = tMainConfig.get(aTextGeneral, "debugWorldGen", false).getBoolean(false); diff --git a/src/main/java/gregtech/api/enums/GT_Values.java b/src/main/java/gregtech/api/enums/GT_Values.java index ca3fe505bf..f36ea881d8 100644 --- a/src/main/java/gregtech/api/enums/GT_Values.java +++ b/src/main/java/gregtech/api/enums/GT_Values.java @@ -170,4 +170,9 @@ public class GT_Values { * If you have to give something a World Parameter but there is no World... (Dummy World) */ public static World DW; + + /** + * This will prevent NEI from crashing but spams the Log. + */ + public static boolean allow_broken_recipemap = false; } diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index ea8294d834..d32516912f 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -1601,12 +1601,33 @@ public class GT_Recipe implements Comparable { ArrayList inputStacks = new ArrayList(inputlimit); for (int i = 0; i < itemLimit; i++, j++) { - inputStacks.add(new FixedPositionedStack(this.mInputs[i].copy(), 48 - j%3 * 18, (j >= 3 ? 5 : 23) )); + if (GT_Values.allow_broken_recipemap) { + if (this != null && this.mInputs != null && this.mInputs[i] != null) + inputStacks.add(new FixedPositionedStack(this.mInputs[i].copy(), 48 - j % 3 * 18, (j >= 3 ? 5 : 23))); + else { + if (this.mOutputs != null && this.mOutputs[0] != null) + GT_Log.out.println("recipe " + this.toString() + " Output 0:" + this.mOutputs[0].getDisplayName() + " has errored!"); + else + GT_Log.out.println("recipe " + this.toString() + " has errored!"); + inputStacks.add(new FixedPositionedStack(new ItemStack(Items.command_block_minecart), 48 - j % 3 * 18, (j >= 3 ? 5 : 23))); + } + }else + inputStacks.add(new FixedPositionedStack(this.mInputs[i].copy(), 48 - j % 3 * 18, (j >= 3 ? 5 : 23))); } for (int i = 0; i < fluidLimit; i++, j++) { - inputStacks.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(this.mFluidInputs[i], true), 48 - j%3 * 18, (j >= 3 ? 5 : 23))); - } + if (GT_Values.allow_broken_recipemap) { + if (this != null && this.mFluidInputs != null && this.mFluidInputs[i] != null) + inputStacks.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(this.mFluidInputs[i], true), 48 - j % 3 * 18, (j >= 3 ? 5 : 23))); + else { + if (this.mOutputs != null && this.mOutputs[0] != null) + GT_Log.out.println("recipe " + this.toString() + " Output 0:" + this.mOutputs[0].getDisplayName() + " has errored!"); + else + GT_Log.out.println("recipe " + this.toString() + " has errored!"); + } + }else + inputStacks.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(this.mFluidInputs[i], true), 48 - j % 3 * 18, (j >= 3 ? 5 : 23))); + } return inputStacks; } -- cgit