diff options
Diffstat (limited to 'src/Java/miscutil/gregtech/common/GregtechRecipeAdder.java')
-rw-r--r-- | src/Java/miscutil/gregtech/common/GregtechRecipeAdder.java | 93 |
1 files changed, 60 insertions, 33 deletions
diff --git a/src/Java/miscutil/gregtech/common/GregtechRecipeAdder.java b/src/Java/miscutil/gregtech/common/GregtechRecipeAdder.java index 8a4e7a1833..ab6d0ad900 100644 --- a/src/Java/miscutil/gregtech/common/GregtechRecipeAdder.java +++ b/src/Java/miscutil/gregtech/common/GregtechRecipeAdder.java @@ -9,62 +9,89 @@ import net.minecraftforge.fluids.FluidStack; public class GregtechRecipeAdder implements IGregtech_RecipeAdder { - /*@Override - public boolean addCokeOvenRecipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { - if (bInput1 == null || aOutput1 == null || bOutput1 == null || aDuration < 1 || aEUt < 1) { - return false; - } - GregtechRecipe.Gregtech_Recipe_Map.sCokeOvenRecipes.addRecipe(aOptimize, aInputs, aOutputs, aSpecial, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue); - return true; - }*/ - - @Override - public boolean addCokeOvenRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt) { - Utils.LOG_INFO("=================================================================================="); - Utils.LOG_INFO("=================================================================================="); + @SuppressWarnings("static-method") + private void debug1(){ Utils.LOG_INFO("=================================================================================="); Utils.LOG_INFO("=================================================================================="); Utils.LOG_INFO("=================================================================================="); Utils.LOG_INFO("Walking Through CokeOven Recipe Creation."); Utils.LOG_INFO("My name is Ralph and I will be your humble host."); - if (((aInput1 == null) /*&& (aFluidInput == null)*/) || ((aOutput == null) && (aFluidOutput == null))) { - Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); - Utils.LOG_INFO("Something was null, returning false"); - return false; - } + } + @SuppressWarnings("static-method") + private void debug2(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt){ Utils.LOG_INFO("=================================================================================="); Utils.LOG_INFO("Taking a step forward."); Utils.LOG_INFO("aInput1 == null && aFluidInput == null || aOutput == null && aFluidOutput == null"); Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); Utils.LOG_INFO("Passed."); - if ((aOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get("cokeoven", aOutput, aDuration)) <= 0)) { - Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); - Utils.LOG_INFO("Something was null, returning false"); - return false; - } + } + @SuppressWarnings("static-method") + private void debug3(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt){ Utils.LOG_INFO("=================================================================================="); Utils.LOG_INFO("Taking a step forward."); Utils.LOG_INFO("(aOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get(cokeoven, aOutput, aDuration)) <= 0)"); Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); Utils.LOG_INFO("Passed."); - if ((aFluidOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get("cokeoven", aFluidOutput.getFluid().getName(), aDuration)) <= 0)) { - Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); - Utils.LOG_INFO("Something was null, returning false"); - return false; - } + } + @SuppressWarnings("static-method") + private void debug4(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt){ Utils.LOG_INFO("=================================================================================="); Utils.LOG_INFO("Taking a step forward."); Utils.LOG_INFO("(aFluidOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get(cokeoven, aFluidOutput.getFluid().getName(), aDuration)) <= 0)"); Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); Utils.LOG_INFO("Passed."); Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); - GregtechRecipe.Gregtech_Recipe_Map.sCokeOvenRecipes.addRecipe(true, new ItemStack[]{aInput1, aInput2}, new ItemStack[]{aOutput}, null, null, new FluidStack[]{aFluidInput}, new FluidStack[]{aFluidOutput}, aDuration, aEUt, 0); - Utils.LOG_INFO("Successfully added a Coke Oven recipe for: "+aOutput.getDisplayName()+" & "+aFluidOutput.getFluid().getName()+", Using "+aInput1.getDisplayName()+", "+aInput2.getDisplayName()+", "+aFluidInput.getFluid().getName()); - Utils.LOG_INFO("=================================================================================="); - Utils.LOG_INFO("=================================================================================="); + + } + @SuppressWarnings("static-method") + private void debug5(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt){ + Utils.LOG_INFO("Successfully added a Coke Oven recipe for: "+aOutput.getDisplayName()+" & "+aFluidOutput.getFluid().getName()+", Using "+aInput1.getDisplayName()+" & "+aInput2.getDisplayName()+" & liquid "+aFluidInput.getFluid().getName()+". This took "+(aDuration/20)+" seconds for "+aEUt+"eu/t."); Utils.LOG_INFO("=================================================================================="); Utils.LOG_INFO("=================================================================================="); Utils.LOG_INFO("=================================================================================="); - return true; + } + + @Override + public boolean addCokeOvenRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt) { + try { + + debug1(); + if (((aInput1 == null) /*&& (aFluidInput == null)*/) || ((aOutput == null) && (aFluidOutput == null))) { + Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); + Utils.LOG_INFO("Something was null, returning false"); + return false; + } + + + debug2(aInput1, aInput2, aFluidInput, aFluidOutput, aOutput, aDuration, aEUt); + if ((aOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get("cokeoven", aOutput, aDuration)) <= 0)) { + Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); + Utils.LOG_INFO("Something was null, returning false"); + return false; + } + + + debug3(aInput1, aInput2, aFluidInput, aFluidOutput, aOutput, aDuration, aEUt); + if ((aFluidOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get("cokeoven", aFluidOutput.getFluid().getName(), aDuration)) <= 0)) { + Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); + Utils.LOG_INFO("Something was null, returning false"); + return false; + } + + debug4(aInput1, aInput2, aFluidInput, aFluidOutput, aOutput, aDuration, aEUt); + if (aFluidInput == null){ + GregtechRecipe.Gregtech_Recipe_Map.sCokeOvenRecipes.addRecipe(true, new ItemStack[]{aInput1, aInput2}, new ItemStack[]{aOutput}, null, null, null, new FluidStack[]{aFluidOutput}, aDuration, aEUt, 0); + } + else { + GregtechRecipe.Gregtech_Recipe_Map.sCokeOvenRecipes.addRecipe(true, new ItemStack[]{aInput1, aInput2}, new ItemStack[]{aOutput}, null, null, new FluidStack[]{aFluidInput}, new FluidStack[]{aFluidOutput}, aDuration, aEUt, 0); + } + debug5(aInput1, aInput2, aFluidInput, aFluidOutput, aOutput, aDuration, aEUt); + + return true; + } catch (NullPointerException e){ + Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); + Utils.LOG_INFO("Failed."); + return false; + } } } |