diff options
author | Jason Mitchell <mitchej@gmail.com> | 2023-01-30 10:56:42 -0800 |
---|---|---|
committer | Jason Mitchell <mitchej@gmail.com> | 2023-01-30 10:56:42 -0800 |
commit | 0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a (patch) | |
tree | 1e2c649f3a6ce3f6b2babd0098a5f4819e9cd0b6 /src/main/java/gregtech/api/util/GT_ParallelHelper.java | |
parent | f8cc82edeb9810c45cba762d733a2c909a302faa (diff) | |
download | GT5-Unofficial-0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a.tar.gz GT5-Unofficial-0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a.tar.bz2 GT5-Unofficial-0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a.zip |
[ci skip] spotlessApply with the new settings
Diffstat (limited to 'src/main/java/gregtech/api/util/GT_ParallelHelper.java')
-rw-r--r-- | src/main/java/gregtech/api/util/GT_ParallelHelper.java | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/src/main/java/gregtech/api/util/GT_ParallelHelper.java b/src/main/java/gregtech/api/util/GT_ParallelHelper.java index 7f32d95d1e..c493184424 100644 --- a/src/main/java/gregtech/api/util/GT_ParallelHelper.java +++ b/src/main/java/gregtech/api/util/GT_ParallelHelper.java @@ -1,25 +1,30 @@ package gregtech.api.util; -import com.gtnewhorizon.gtnhlib.util.map.ItemStackMap; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.multitileentity.multiblock.base.MultiBlockController; -import gregtech.api.objects.XSTR; -import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_OutputBus_ME; -import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_Output_ME; import java.util.Comparator; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.PriorityQueue; + import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; + import org.apache.commons.lang3.tuple.MutablePair; import org.apache.commons.lang3.tuple.MutableTriple; +import com.gtnewhorizon.gtnhlib.util.map.ItemStackMap; + +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.multitileentity.multiblock.base.MultiBlockController; +import gregtech.api.objects.XSTR; +import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_OutputBus_ME; +import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_Output_ME; + public class GT_ParallelHelper { + /** * @mMachineMeta a MetaTileEntity Controller */ @@ -39,7 +44,8 @@ public class GT_ParallelHelper { /** * @mCurrentParallel The current parallel possible for the multiblock * @mMaxParallel The maximum possible parallel possible for the multiblock - * @mBatchModifier The Batch Modifier applied when batch mode is enabled. 1 does nothing. 2 doubles max possible parallel, but also duration + * @mBatchModifier The Batch Modifier applied when batch mode is enabled. 1 does nothing. 2 doubles max possible + * parallel, but also duration */ private int mCurrentParallel = 0, mMaxParallel = 1, mBatchModifier = 1; /** @@ -56,7 +62,8 @@ public class GT_ParallelHelper { * @mVoidProtection Does the multi have void protection enabled * @mConsume Should the Parallel Helper automatically consume for the multi * @mBatchMode Is batch mode turned on? - * @mCalculateOutputs Should the Parallel Helper automatically calculate the outputs of the recipe with current parallel + * @mCalculateOutputs Should the Parallel Helper automatically calculate the outputs of the recipe with current + * parallel * @mBuilt Has the Parallel Helper been built? */ private boolean mVoidProtection, mConsume, mBatchMode, mCalculateOutputs, mBuilt; @@ -143,8 +150,8 @@ public class GT_ParallelHelper { } /** - * Enables Batch mode. Can do up to an additional processed recipes of mCurrentParallel * mBatchModifier - * A batch modifier of 1 does nothing + * Enables Batch mode. Can do up to an additional processed recipes of mCurrentParallel * mBatchModifier A batch + * modifier of 1 does nothing */ public GT_ParallelHelper enableBatchMode(int aBatchModifier) { mBatchMode = true; @@ -153,7 +160,8 @@ public class GT_ParallelHelper { } /** - * Enables the outputs to be calculated with its current Parallels, useful if one isn't doing anything special with outputs + * Enables the outputs to be calculated with its current Parallels, useful if one isn't doing anything special with + * outputs */ public GT_ParallelHelper enableOutputCalculation() { mCalculateOutputs = true; @@ -278,9 +286,8 @@ public class GT_ParallelHelper { float tRecipeEUt = mRecipe.mEUt * mEUtModifier; // Consume inputs to determine normal parallel - for (; - mCurrentParallel < mMaxParallel / mBatchModifier && tCurrentUsage < (mAvailableEUt - tRecipeEUt); - mCurrentParallel++) { + for (; mCurrentParallel < mMaxParallel / mBatchModifier + && tCurrentUsage < (mAvailableEUt - tRecipeEUt); mCurrentParallel++) { if (mRecipe.isRecipeInputEqual(true, false, tFluidInputs, tItemInputs)) { tCurrentUsage += tRecipeEUt; } else { @@ -373,10 +380,8 @@ public class GT_ParallelHelper { if (!tHatch.outputsLiquids()) { continue; } - if (tHatch.isFluidLocked() - && tLockedFluidName != null - && !tLockedFluidName.equals( - tFluidOutput.getFluid().getName())) { + if (tHatch.isFluidLocked() && tLockedFluidName != null + && !tLockedFluidName.equals(tFluidOutput.getFluid().getName())) { continue; } } @@ -391,8 +396,8 @@ public class GT_ParallelHelper { } // now that all partial/restricted hatches have been counted, create a priority queue for our outputs // the lowest priority fluid is the number of complete parallel crafts we can support - PriorityQueue<MutableTriple<Integer, Integer, FluidStack>> aParallelQueue = - new PriorityQueue<>(Comparator.comparing(MutableTriple::getLeft)); + PriorityQueue<MutableTriple<Integer, Integer, FluidStack>> aParallelQueue = new PriorityQueue<>( + Comparator.comparing(MutableTriple::getLeft)); for (Entry<FluidStack, MutablePair<Integer, Integer>> entry : tParallels.entrySet()) { aParallelQueue.add(new MutableTriple<>(entry.getValue().left, entry.getValue().right, entry.getKey())); } @@ -470,8 +475,8 @@ public class GT_ParallelHelper { } // now that all partial stacks have been counted, create a priority queue for our outputs // the lowest priority item is the number of complete parallel crafts we can support - PriorityQueue<MutableTriple<Integer, Integer, ItemStack>> aParallelQueue = - new PriorityQueue<>(Comparator.comparing(MutableTriple::getLeft)); + PriorityQueue<MutableTriple<Integer, Integer, ItemStack>> aParallelQueue = new PriorityQueue<>( + Comparator.comparing(MutableTriple::getLeft)); for (Entry<ItemStack, MutablePair<Integer, Integer>> entry : tParallels.entrySet()) { aParallelQueue.add(new MutableTriple<>(entry.getValue().left, entry.getValue().right, entry.getKey())); } |