diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2016-09-06 15:57:29 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-09-06 15:57:29 +1000 |
commit | 58fc12f3bac1c7031f3e1d1a22bf29285e529999 (patch) | |
tree | 94c86f55c89a3b03ad083c26a3663d28ff21bf2a /src/Java/miscutil/xmod | |
parent | a86f2fe29fba9173f65a0ef7a6961c17e5d1cc4b (diff) | |
download | GT5-Unofficial-58fc12f3bac1c7031f3e1d1a22bf29285e529999.tar.gz GT5-Unofficial-58fc12f3bac1c7031f3e1d1a22bf29285e529999.tar.bz2 GT5-Unofficial-58fc12f3bac1c7031f3e1d1a22bf29285e529999.zip |
$ Fixed the recipe handlers for the Dehydrator and the Matter Fabricator.
> Matter Fabricator now runs properly without UU-A, just takes 3x longer (not 4x as usual for mass fabs)
Diffstat (limited to 'src/Java/miscutil/xmod')
3 files changed, 65 insertions, 26 deletions
diff --git a/src/Java/miscutil/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityMassFabricator.java b/src/Java/miscutil/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityMassFabricator.java index 13d10e71de..45948cefbb 100644 --- a/src/Java/miscutil/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityMassFabricator.java +++ b/src/Java/miscutil/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityMassFabricator.java @@ -19,6 +19,7 @@ import java.util.Arrays; import miscutil.core.block.ModBlocks; import miscutil.core.lib.CORE; import miscutil.core.util.Utils; +import miscutil.core.util.fluid.FluidUtils; import miscutil.core.util.item.UtilsItems; import miscutil.xmod.gregtech.api.gui.GUI_MultiMachine; import net.minecraft.block.Block; @@ -37,6 +38,8 @@ public class GregtechMetaTileEntityMassFabricator extends GT_MetaTileEntity_Mult public static boolean sRequiresUUA = false; private int recipeCounter = 0; private static Block IC2Glass = Block.getBlockFromItem(UtilsItems.getItem("IC2:blockAlloyGlass")); + FluidStack tempFake = FluidUtils.getFluidStack("uuamplifier", 1); + GT_Recipe fakeRecipe; //public FluidStack mFluidOut = Materials.UUMatter.getFluid(1L); public GregtechMetaTileEntityMassFabricator(int aID, String aName, String aNameRegional) { @@ -109,6 +112,7 @@ public class GregtechMetaTileEntityMassFabricator extends GT_MetaTileEntity_Mult byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tFluidList.size()]), 0, tFluidList.size()); if (tFluids.length > 0) { + //Utils.LOG_INFO("Input fluid found"); for(int i = 0;i<tFluids.length;i++){ GT_Recipe tRecipe = Recipe_GT.Gregtech_Recipe_Map.sMatterFab2Recipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], new FluidStack[]{tFluids[i]}, new ItemStack[]{}); if (tRecipe != null) { @@ -141,9 +145,52 @@ public class GregtechMetaTileEntityMassFabricator extends GT_MetaTileEntity_Mult } else { Utils.LOG_INFO("Invalid Recipe"); + return false; } } } + else if (tFluids.length == 0) { + //Utils.LOG_INFO("Input fluid not found"); + fakeRecipe = Recipe_GT.Gregtech_Recipe_Map.sMatterFab2Recipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], new FluidStack[]{tempFake}, new ItemStack[]{}); + + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + + this.mEUt = 32; + this.mMaxProgresstime = (160*20); + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 2; + } + + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + + if (fakeRecipe != null) { + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + this.mOutputItems = new ItemStack[]{fakeRecipe.getOutput(0)}; + this.mOutputFluids = fakeRecipe.mFluidOutputs.clone(); + ArrayUtils.reverse(mOutputFluids); + recipeCounter++; + updateSlots(); + //Utils.LOG_INFO("Recipes Finished: "+recipeCounter); + return true; + } + Utils.LOG_INFO("fakeRecipe was Null"); + + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + this.mOutputItems = new ItemStack[]{null}; + this.mOutputFluids = new FluidStack[] {FluidUtils.getFluidStack("uumatter", 1)}; + ArrayUtils.reverse(mOutputFluids); + recipeCounter++; + updateSlots(); + Utils.LOG_INFO("Recipes Finished: "+recipeCounter); + return true; + } + else { + Utils.LOG_INFO("Invalid no input Recipe"); + } return false; } diff --git a/src/Java/miscutil/xmod/gregtech/recipes/GregtechRecipeAdder.java b/src/Java/miscutil/xmod/gregtech/recipes/GregtechRecipeAdder.java index 2589ceee23..2eca5b40be 100644 --- a/src/Java/miscutil/xmod/gregtech/recipes/GregtechRecipeAdder.java +++ b/src/Java/miscutil/xmod/gregtech/recipes/GregtechRecipeAdder.java @@ -72,35 +72,17 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { public boolean addMatterFabricatorRecipe(FluidStack aFluidInput, FluidStack aFluidOutput, int aDuration, int aEUt) { try { try { - RECIPEHANDLER_MatterFabricator.debug1(); + //RECIPEHANDLER_MatterFabricator.debug1(); if (aFluidOutput == null) { - Utils.LOG_WARNING("aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); + //Utils.LOG_WARNING("aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); Utils.LOG_WARNING("Something was null, returning false"); return false; } } catch (NullPointerException e){e.getStackTrace();} - try { - RECIPEHANDLER_MatterFabricator.debug2(aFluidInput, aFluidOutput, aDuration, aEUt); - if ((aFluidOutput == null)/* && ((aDuration = GregTech_API.sRecipeFile.get("matterfab", null, aDuration)) <= 0)*/) { - Utils.LOG_WARNING("aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); - Utils.LOG_WARNING("Something was null, returning false"); - return false; - } - - } catch (NullPointerException e){e.getStackTrace();} - /*try { - - RECIPEHANDLER_MatterFabricator.debug3(aFluidInput, aFluidOutput, aDuration, aEUt); - if ((aFluidOutput == null) && ((aDuration = GregTech_API.sRecipeFile.get("matterfab", aFluidOutput.getFluid().getName(), aDuration)) <= 0)) { - Utils.LOG_WARNING("aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); - Utils.LOG_WARNING("Something was null, returning false"); - return false; - } - - } catch (NullPointerException e){e.getStackTrace();}*/ - try { - RECIPEHANDLER_MatterFabricator.debug4(aFluidInput, aFluidOutput, aDuration, aEUt); + try{ + + //RECIPEHANDLER_MatterFabricator.debug4(aFluidInput, aFluidOutput, aDuration, aEUt); if (aFluidInput == null){ //Recipe_GT.Gregtech_Recipe_Map.sMatterFabRecipes.addRecipe(true, null, new FluidStack[]{aFluidOutput}, aDuration, aEUt, 0); Recipe_GT.Gregtech_Recipe_Map.sMatterFab2Recipes.addRecipe(true, null, null, null, null, new FluidStack[]{aFluidOutput}, aDuration, aEUt, 0); @@ -117,7 +99,7 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { return false; } } catch (Throwable e){ - Utils.LOG_WARNING("aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); + //Utils.LOG_WARNING("aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); Utils.LOG_WARNING("Failed."); e.getStackTrace(); return false; @@ -204,7 +186,7 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { Utils.LOG_INFO("Recipe requires input: "+aInput2.getDisplayName()+" x"+aInput2.stackSize); } if (aFluidInput != null){ - Utils.LOG_INFO("Recipe requires input: "+aFluidInput.getFluid().getName()+" "+aFluidInput.amount+"mb"); + Utils.LOG_INFO("Recipe requires input: "+aFluidInput.getFluid().getName()+" "+aFluidInput.amount+"mbst"); } if (((aInput1 == null) && (aFluidInput == null)) || ((aOutputItems == null) && (aFluidOutput == null))) { return false; diff --git a/src/Java/miscutil/xmod/gregtech/recipes/machines/RECIPEHANDLER_MatterFabricator.java b/src/Java/miscutil/xmod/gregtech/recipes/machines/RECIPEHANDLER_MatterFabricator.java index 165112451f..0e92004390 100644 --- a/src/Java/miscutil/xmod/gregtech/recipes/machines/RECIPEHANDLER_MatterFabricator.java +++ b/src/Java/miscutil/xmod/gregtech/recipes/machines/RECIPEHANDLER_MatterFabricator.java @@ -36,7 +36,17 @@ public class RECIPEHANDLER_MatterFabricator { } public static void debug5(FluidStack aFluidInput, FluidStack aFluidOutput, int aDuration, int aEUt){ - Utils.LOG_INFO("Successfully added a Matter Fabrication recipe for: "+aFluidOutput.getFluid().getName()+", Using "+" liquid "+aFluidInput.getFluid().getName()+". This takes "+(aDuration/20)+" seconds for "+aEUt+"eu/t."); + String a = "nothing"; + String b = ""; + + if (aFluidInput != null){ + a = aFluidInput.getFluid().getName(); + } + if (aFluidOutput != null){ + b = aFluidOutput.getFluid().getName(); + } + + Utils.LOG_INFO("Successfully added a Matter Fabrication recipe for: "+b+", Using "+" liquid "+a+". This takes "+(aDuration/20)+" seconds for "+aEUt+"eu/t."); Utils.LOG_WARNING("=================================================================================="); Utils.LOG_WARNING("=================================================================================="); Utils.LOG_WARNING("=================================================================================="); |