From 75af5c94f30d41a7a525e74db90598d0f0360ce1 Mon Sep 17 00:00:00 2001 From: Dariusz KomosiƄski Date: Mon, 13 Nov 2023 11:06:28 +0100 Subject: Fix MDT void protection (#367) * Update buildscript. * Implement custom MDT logic for dumping fluid to ME. * Code cleanup. Former-commit-id: 37d1e00c283ef1ae8b03150212c3ca425b0ef3b5 --- .../mega/GT_TileEntity_MegaDistillTower.java | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/main/java/com') diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaDistillTower.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaDistillTower.java index 343a06cece..4644b33dc8 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaDistillTower.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaDistillTower.java @@ -56,6 +56,7 @@ import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; +import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_Output_ME; public class GT_TileEntity_MegaDistillTower extends GT_TileEntity_MegaMultiBlockBase implements ISurvivalConstructable { @@ -376,6 +377,30 @@ public class GT_TileEntity_MegaDistillTower extends GT_TileEntity_MegaMultiBlock return new ProcessingLogic().setMaxParallel(ConfigHandler.megaMachinesMax); } + @Override + public boolean canDumpFluidToME() { + + // All fluids can be dumped to ME only if each layer contains a ME Output Hatch. + for (List tLayerOutputHatches : this.mOutputHatchesByLayer) { + + boolean foundMEHatch = false; + + for (IFluidStore tHatch : tLayerOutputHatches) { + if (tHatch instanceof GT_MetaTileEntity_Hatch_Output_ME) { + foundMEHatch = true; + break; + } + } + + // Exit if we didn't find a valid hatch on this layer. + if (!foundMEHatch) { + return false; + } + } + + return true; + } + @Override protected void addFluidOutputs(FluidStack[] mOutputFluids2) { for (int i = 0; i < mOutputFluids2.length && i < this.mOutputHatchesByLayer.size(); i++) { -- cgit