aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormiozune <miozune@gmail.com>2023-06-04 19:54:27 +0900
committerGitHub <noreply@github.com>2023-06-04 12:54:27 +0200
commitb093eda18787f29ec1aeba2e0b67b5b4bbafea98 (patch)
tree8efbfd870592971e3e4f72633246352f913c0c58
parentdb08b64b33619ce886a7992643118b09959f21bf (diff)
downloadGT5-Unofficial-b093eda18787f29ec1aeba2e0b67b5b4bbafea98.tar.gz
GT5-Unofficial-b093eda18787f29ec1aeba2e0b67b5b4bbafea98.tar.bz2
GT5-Unofficial-b093eda18787f29ec1aeba2e0b67b5b4bbafea98.zip
Fix void protection for Sparge Tower and Dangote (#653)
-rw-r--r--dependencies.gradle2
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_SpargeTower.java35
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java6
3 files changed, 41 insertions, 2 deletions
diff --git a/dependencies.gradle b/dependencies.gradle
index a7185119e1..322ff90e60 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -1,5 +1,5 @@
dependencies {
- api('com.github.GTNewHorizons:GT5-Unofficial:5.09.43.57-pre:dev')
+ api('com.github.GTNewHorizons:GT5-Unofficial:5.09.43.67-pre:dev')
api("com.github.GTNewHorizons:bartworks:0.7.12:dev")
implementation('curse.maven:cofh-core-69162:2388751')
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_SpargeTower.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_SpargeTower.java
index 64cce876c0..6f12db25ba 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_SpargeTower.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_SpargeTower.java
@@ -29,6 +29,7 @@ import com.gtnewhorizon.structurelib.structure.StructureDefinition;
import gregtech.api.interfaces.IHatchElement;
import gregtech.api.interfaces.IIconContainer;
+import gregtech.api.interfaces.fluid.IFluidStore;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
@@ -215,7 +216,10 @@ public class GregtechMetaTileEntity_SpargeTower extends GregtechMeta_MultiBlockB
.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids);
if (tRecipe != null) {
Logger.INFO("Found recipe!");
- if (tRecipe.isRecipeInputEqual(true, tFluids)) {
+ FluidStack[] possibleOutputs = getPossibleByproductsOfSparge(
+ tRecipe.mFluidInputs[0],
+ tRecipe.mFluidInputs[1]).toArray(new FluidStack[0]);
+ if (canOutputAll(possibleOutputs) && tRecipe.isRecipeInputEqual(true, tFluids)) {
Logger.INFO("Found recipe that matches!");
this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
this.mEfficiencyIncrease = 10000;
@@ -250,6 +254,30 @@ public class GregtechMetaTileEntity_SpargeTower extends GregtechMeta_MultiBlockB
return false;
}
+ private static List<FluidStack> getPossibleByproductsOfSparge(final FluidStack aSpargeGas,
+ final FluidStack aSpentFuel) {
+ GasSpargingRecipe aSpargeRecipe = GasSpargingRecipeMap.findRecipe(aSpargeGas, aSpentFuel);
+ ArrayList<FluidStack> aOutputGases = new ArrayList<>();
+ if (aSpargeRecipe == null) {
+ return aOutputGases;
+ }
+
+ aOutputGases.add(aSpargeRecipe.mOutputSpargedFuel.copy());
+ ArrayList<FluidStack> aTempMap = new ArrayList<>();
+ for (int i = 2; i < aSpargeRecipe.mFluidOutputs.length; i++) {
+ int aGasAmount = aSpargeRecipe.mMaxOutputQuantity[i - 2] / 100;
+ FluidStack aOutput = aSpargeRecipe.mFluidOutputs[i].copy();
+ FluidStack aSpargeOutput = null;
+ if (aGasAmount > 0) {
+ aSpargeOutput = new FluidStack(aOutput.getFluid(), aGasAmount);
+ }
+ aTempMap.add(aSpargeOutput);
+ }
+ aOutputGases.add(new FluidStack(aSpargeRecipe.mInputGas.getFluid(), aSpargeRecipe.mInputGas.amount));
+ aOutputGases.addAll(aTempMap);
+ return aOutputGases;
+ }
+
private static ArrayList<FluidStack> getByproductsOfSparge(final FluidStack aSpargeGas,
final FluidStack aSpentFuel) {
GasSpargingRecipe aSpargeRecipe = GasSpargingRecipeMap.findRecipe(aSpargeGas, aSpentFuel);
@@ -316,6 +344,11 @@ public class GregtechMetaTileEntity_SpargeTower extends GregtechMeta_MultiBlockB
}
@Override
+ public List<? extends IFluidStore> getFluidOutputSlots(FluidStack[] toOutput) {
+ return getFluidOutputSlotsByLayer(toOutput, mOutputHatchesByLayer);
+ }
+
+ @Override
protected IAlignmentLimits getInitialAlignmentLimits() {
// don't rotate a freaking tower, it won't work
return (d, r, f) -> d.offsetY == 0 && r.isNotRotated() && !f.isVerticallyFliped();
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java
index 8fd6c0bd5c..42eddd9769 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java
@@ -35,6 +35,7 @@ import gregtech.api.GregTech_API;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.IHatchElement;
import gregtech.api.interfaces.IIconContainer;
+import gregtech.api.interfaces.fluid.IFluidStore;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
@@ -355,6 +356,11 @@ public class GregtechMetaTileEntity_Adv_DistillationTower extends
}
@Override
+ public List<? extends IFluidStore> getFluidOutputSlots(FluidStack[] toOutput) {
+ return getFluidOutputSlotsByLayer(toOutput, mOutputHatchesByLayer);
+ }
+
+ @Override
public String getMachineType() {
return "Distillery, Distillation Tower";
}