diff options
author | Glease <4586901+Glease@users.noreply.github.com> | 2023-10-23 00:04:53 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-22 16:04:53 +0000 |
commit | d3eeacdeb9a7e0bb64f608dd92eb06002acf0ffe (patch) | |
tree | 22643cb6433d8f9a54ee4b762445f8f4986952d4 /src/main/java/gregtech/common | |
parent | a98fb7f64b9263fe3f720e772c19e091d1bb409d (diff) | |
download | GT5-Unofficial-d3eeacdeb9a7e0bb64f608dd92eb06002acf0ffe.tar.gz GT5-Unofficial-d3eeacdeb9a7e0bb64f608dd92eb06002acf0ffe.tar.bz2 GT5-Unofficial-d3eeacdeb9a7e0bb64f608dd92eb06002acf0ffe.zip |
implement drain for stocking input hatch (#2347)
This is primarily used by depleteInput() from controller. only drain from internal source (i.e. ForgeDirection.UNKNOWN) is allowed
Diffstat (limited to 'src/main/java/gregtech/common')
3 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_Input_ME.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_Input_ME.java index 332107ad6d..7c2ae6b175 100644 --- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_Input_ME.java +++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_Input_ME.java @@ -208,6 +208,20 @@ public class GT_MetaTileEntity_Hatch_Input_ME extends GT_MetaTileEntity_Hatch_In } @Override + public FluidStack drain(ForgeDirection side, FluidStack aFluid, boolean doDrain) { + // this is an ME input hatch. allowing draining via logistics would be very wrong (and against + // canTankBeEmptied()) but we do need to support draining from controller, which uses the UNKNOWN direction. + if (side != ForgeDirection.UNKNOWN) return null; + FluidStack stored = getMatchingFluidStack(aFluid); + if (stored == null) return null; + FluidStack drained = GT_Utility.copyAmount(Math.min(stored.amount, aFluid.amount), stored); + if (doDrain) { + stored.amount -= drained.amount; + } + return drained; + } + + @Override public void startRecipeProcessing() { processingRecipe = true; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java index d0e9af397e..fe87fde89a 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java @@ -273,6 +273,7 @@ public class GT_MetaTileEntity_HeatExchanger extends // 1:160 ratio with distilled water consumption FluidStack distilledStack = GT_ModHandler.getDistilledWater(distilledConsumed); + startRecipeProcessing(); if (depleteInput(distilledStack)) // Consume the distilled water { if (superheated) { @@ -291,6 +292,7 @@ public class GT_MetaTileEntity_HeatExchanger extends explodeMultiblock(); // Generate crater } } + endRecipeProcessing(); } return true; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java index 8d165e34f4..60b6137fd8 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java @@ -364,6 +364,7 @@ public abstract class GT_MetaTileEntity_LargeBoiler excessWater += amount * STEAM_PER_WATER - tGeneratedEU; amount -= excessWater / STEAM_PER_WATER; excessWater %= STEAM_PER_WATER; + startRecipeProcessing(); if (isSuperheated()) { // Consumes only one third of the water if producing Superheated Steam, to maintain water in the // chain. @@ -386,6 +387,7 @@ public abstract class GT_MetaTileEntity_LargeBoiler explodeMultiblock(); } } + endRecipeProcessing(); } return true; } |