diff options
Diffstat (limited to 'src/main/java/gregtech/api')
6 files changed, 15 insertions, 28 deletions
diff --git a/src/main/java/gregtech/api/interfaces/fluid/IFluidStore.java b/src/main/java/gregtech/api/interfaces/fluid/IFluidStore.java index 047cf4df5b..5b5bb08c87 100644 --- a/src/main/java/gregtech/api/interfaces/fluid/IFluidStore.java +++ b/src/main/java/gregtech/api/interfaces/fluid/IFluidStore.java @@ -19,4 +19,11 @@ public interface IFluidStore extends IFluidTank { * @return Whether to allow given fluid to be inserted into this. */ boolean canStoreFluid(@Nonnull FluidStack fluidStack); + + /** + * @return The amount of fluid that can be stored in this. + */ + default int getAvailableSpace() { + return getCapacity() - getFluidAmount(); + } } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IVoidable.java b/src/main/java/gregtech/api/interfaces/tileentity/IVoidable.java index 841fd07bba..f55d71debc 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IVoidable.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IVoidable.java @@ -79,11 +79,4 @@ public interface IVoidable { * as this might be called every tick and cause lag. */ boolean canDumpItemToME(); - - /** - * @return If this machine has ability to dump fluid outputs to ME network. - * This doesn't need to check if it can actually dump to ME, - * as this might be called every tick and cause lag. - */ - boolean canDumpFluidToME(); } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java index 875148d9b6..2a5e3c1552 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java @@ -109,7 +109,6 @@ import gregtech.common.tileentities.machines.MTEHatchCraftingInputME; import gregtech.common.tileentities.machines.MTEHatchInputBusME; import gregtech.common.tileentities.machines.MTEHatchInputME; import gregtech.common.tileentities.machines.MTEHatchOutputBusME; -import gregtech.common.tileentities.machines.MTEHatchOutputME; import gregtech.common.tileentities.machines.multi.MTELargeTurbine; import it.unimi.dsi.fastutil.objects.Object2ReferenceOpenHashMap; import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap; @@ -2291,18 +2290,6 @@ public abstract class MTEMultiBlockBase extends MetaTileEntity } @Override - public boolean canDumpFluidToME() { - for (IFluidStore tHatch : getFluidOutputSlots(new FluidStack[0])) { - if (tHatch instanceof MTEHatchOutputME) { - if ((((MTEHatchOutputME) tHatch).canAcceptFluid())) { - return true; - } - } - } - return false; - } - - @Override public Pos2d getVoidingModeButtonPos() { return new Pos2d(8, 91); } diff --git a/src/main/java/gregtech/api/multitileentity/multiblock/base/Controller.java b/src/main/java/gregtech/api/multitileentity/multiblock/base/Controller.java index d6b4ef7fe3..c0fb6cedb4 100644 --- a/src/main/java/gregtech/api/multitileentity/multiblock/base/Controller.java +++ b/src/main/java/gregtech/api/multitileentity/multiblock/base/Controller.java @@ -915,11 +915,6 @@ public abstract class Controller<C extends Controller<C, P>, P extends MuTEProce } @Override - public boolean canDumpFluidToME() { - return false; - } - - @Override public boolean supportsInputSeparation() { return true; } diff --git a/src/main/java/gregtech/api/util/OutputHatchWrapper.java b/src/main/java/gregtech/api/util/OutputHatchWrapper.java index 55f467198a..d570780317 100644 --- a/src/main/java/gregtech/api/util/OutputHatchWrapper.java +++ b/src/main/java/gregtech/api/util/OutputHatchWrapper.java @@ -62,4 +62,9 @@ public class OutputHatchWrapper implements IFluidStore { public boolean canStoreFluid(@NotNull FluidStack fluidStack) { return outputHatch.canStoreFluid(fluidStack) && filter.test(fluidStack); } + + @Override + public int getAvailableSpace() { + return outputHatch.getAvailableSpace(); + } } diff --git a/src/main/java/gregtech/api/util/VoidProtectionHelper.java b/src/main/java/gregtech/api/util/VoidProtectionHelper.java index cf98e26b66..227601113b 100644 --- a/src/main/java/gregtech/api/util/VoidProtectionHelper.java +++ b/src/main/java/gregtech/api/util/VoidProtectionHelper.java @@ -214,7 +214,7 @@ public class VoidProtectionHelper { return; } } - if (protectExcessFluid && fluidOutputs.length > 0 && !machine.canDumpFluidToME()) { + if (protectExcessFluid && fluidOutputs.length > 0) { maxParallel = Math.min(calculateMaxFluidParallels(), maxParallel); if (maxParallel <= 0) { isFluidFull = true; @@ -255,7 +255,7 @@ public class VoidProtectionHelper { } for (IFluidStore tHatch : hatches) { - int tSpaceLeft = tHatch.getCapacity() - tHatch.getFluidAmount(); + int tSpaceLeft = tHatch.getAvailableSpace(); // check if hatch filled if (tSpaceLeft <= 0) continue; @@ -289,7 +289,7 @@ public class VoidProtectionHelper { ParallelStackInfo<FluidStack> tParallel = aParallelQueue.poll(); assert tParallel != null; // will always be true, specifying assert here to avoid IDE/compiler warnings Integer tCraftSize = tFluidOutputMap.get(tParallel.stack); - int tSpaceLeft = tHatch.getCapacity(); + int tSpaceLeft = tHatch.getAvailableSpace(); tParallel.batch += (tParallel.partial + tSpaceLeft) / tCraftSize; tParallel.partial = (tParallel.partial + tSpaceLeft) % tCraftSize; aParallelQueue.add(tParallel); |