diff options
Diffstat (limited to 'src/main/java/gregtech/common')
-rw-r--r-- | src/main/java/gregtech/common/tileentities/machines/multi/MTEHeatExchanger.java | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEHeatExchanger.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEHeatExchanger.java index fb90f1acc4..688fa3e706 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEHeatExchanger.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEHeatExchanger.java @@ -48,6 +48,8 @@ import gregtech.api.util.GTLog; import gregtech.api.util.GTModHandler; import gregtech.api.util.GTUtility; import gregtech.api.util.MultiblockTooltipBuilder; +import gregtech.common.tileentities.machines.IRecipeProcessingAwareHatch; +import gregtech.common.tileentities.machines.MTEHatchInputME; public class MTEHeatExchanger extends MTEEnhancedMultiBlockBase<MTEHeatExchanger> implements ISurvivalConstructable { @@ -179,9 +181,19 @@ public class MTEHeatExchanger extends MTEEnhancedMultiBlockBase<MTEHeatExchanger @Override @Nonnull public CheckRecipeResult checkProcessing() { - if (mInputHotFluidHatch.getFluid() == null) return CheckRecipeResultRegistry.NO_RECIPE; + FluidStack hotFluid = null; + if (mInputHotFluidHatch instanceof MTEHatchInputME inputME) { + FluidStack[] fluids = inputME.getStoredFluids(); + if (fluids.length > 0) { + hotFluid = fluids[0]; + } + } else { + hotFluid = mInputHotFluidHatch.getFluid(); + } + + if (hotFluid == null) return CheckRecipeResultRegistry.NO_RECIPE; - int fluidAmountToConsume = mInputHotFluidHatch.getFluidAmount(); // how much fluid is in hatch + int fluidAmountToConsume = hotFluid.amount; // how much fluid is in hatch superheated_threshold = 4000; // default: must have 4000L per second to generate superheated steam float efficiency = 1f; // default: operate at 100% efficiency with no integrated circuitry @@ -202,9 +214,7 @@ public class MTEHeatExchanger extends MTEEnhancedMultiBlockBase<MTEHeatExchanger efficiency -= penalty; - var coolant = LHECoolantRegistry.getCoolant( - mInputHotFluidHatch.getFluid() - .getFluid()); + var coolant = LHECoolantRegistry.getCoolant(hotFluid.getFluid()); if (coolant == null) { superheated_threshold = 0; @@ -220,8 +230,9 @@ public class MTEHeatExchanger extends MTEEnhancedMultiBlockBase<MTEHeatExchanger // Don't consume too much hot fluid per second fluidAmountToConsume = Math.min(fluidAmountToConsume, superheated_threshold * 2); - - mInputHotFluidHatch.drain(fluidAmountToConsume, true); + // the 3-arg drain will work on both normal hatch and ME hatch + mInputHotFluidHatch + .drain(ForgeDirection.UNKNOWN, new FluidStack(hotFluid.getFluid(), fluidAmountToConsume), true); mOutputColdFluidHatch.fill(coolant.getColdFluid(fluidAmountToConsume), true); this.mMaxProgresstime = 20; @@ -393,4 +404,20 @@ public class MTEHeatExchanger extends MTEEnhancedMultiBlockBase<MTEHeatExchanger if (mMachine) return -1; return survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 1, 3, 0, elementBudget, env, false, true); } + + @Override + public void startRecipeProcessing() { + super.startRecipeProcessing(); + if (mInputHotFluidHatch instanceof IRecipeProcessingAwareHatch aware && mInputHotFluidHatch.isValid()) { + aware.startRecipeProcessing(); + } + } + + @Override + public void endRecipeProcessing() { + super.endRecipeProcessing(); + if (mInputHotFluidHatch instanceof IRecipeProcessingAwareHatch aware && mInputHotFluidHatch.isValid()) { + aware.endRecipeProcessing(this); + } + } } |