diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-12-30 01:50:31 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-30 01:50:31 +0000 |
commit | f1e56afe38ded7b25a940571d51f0cb3cffa2348 (patch) | |
tree | 26965e2e2f2f996d0b03557641c6563e29e2ba0d /src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity | |
parent | 06e9c7742b1a94fbcc5965588171b26d7468f44c (diff) | |
parent | 323403172788232dbe07d02427a670e69e7a0834 (diff) | |
download | GT5-Unofficial-f1e56afe38ded7b25a940571d51f0cb3cffa2348.tar.gz GT5-Unofficial-f1e56afe38ded7b25a940571d51f0cb3cffa2348.tar.bz2 GT5-Unofficial-f1e56afe38ded7b25a940571d51f0cb3cffa2348.zip |
Merge pull request #583 from botn365/energy-parrallel-fix
$ Fix Multiblocks not consuming 2A per input hatch if available.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity')
-rw-r--r-- | src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index 3869adb7ab..4a6cad20c3 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -989,6 +989,15 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult * log("GOOD RETURN - 1"); return true; } */ + public long getMaxInputEnergy() { + long rEnergy = 0; + if (mEnergyHatches.size() < 2) // so it only takes 1 amp is only 1 hatch is present so it works like most gt multies + return mEnergyHatches.get(0).getBaseMetaTileEntity().getInputVoltage(); + for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) + if (isValidMetaTileEntity(tHatch)) rEnergy += tHatch.getBaseMetaTileEntity().getInputVoltage() * tHatch.getBaseMetaTileEntity().getInputAmperage(); + return rEnergy; + } + public boolean checkRecipeGeneric( ItemStack[] aItemInputs, FluidStack[] aFluidInputs, int aMaxParallelRecipes, int aEUPercent, @@ -1003,6 +1012,7 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult long tVoltage = getMaxInputVoltage(); byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + long tEnergy = getMaxInputEnergy(); log("Running checkRecipeGeneric(0)"); GT_Recipe tRecipe = findRecipe( @@ -1079,7 +1089,7 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult log("tVoltage: "+tVoltage); log("tRecipeEUt: "+tRecipeEUt); // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits - for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tVoltage - tRecipeEUt); parallelRecipes++) { + for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) { if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) { log("Broke at "+parallelRecipes+"."); break; @@ -1289,7 +1299,7 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult long tVoltage = getMaxInputVoltage(); byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - + long tEnergy = getMaxInputEnergy(); log("Running checkRecipeGeneric(0)"); GT_Recipe tRecipe = aRecipe != null ? aRecipe : findRecipe( @@ -1386,7 +1396,7 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult log("tVoltage: "+tVoltage); log("tRecipeEUt: "+tRecipeEUt); // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits - for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tVoltage - tRecipeEUt); parallelRecipes++) { + for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) { if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) { log("Broke at "+parallelRecipes+"."); break; |