aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/covers
diff options
context:
space:
mode:
authorNexusNull <p.wellershaus@googlemail.com>2023-03-11 22:59:54 +0100
committerGitHub <noreply@github.com>2023-03-11 22:59:54 +0100
commitf9f1bd2f8d83bf9289254beb93efd65f9bcc5fed (patch)
treedf3a50bd38519e8368e8750ab85ddcfc11fc6f52 /src/main/java/gregtech/common/covers
parentc182412944cb3159b5068e57614cb0944f872a26 (diff)
downloadGT5-Unofficial-f9f1bd2f8d83bf9289254beb93efd65f9bcc5fed.tar.gz
GT5-Unofficial-f9f1bd2f8d83bf9289254beb93efd65f9bcc5fed.tar.bz2
GT5-Unofficial-f9f1bd2f8d83bf9289254beb93efd65f9bcc5fed.zip
Add regulator abilities to Steam Valve (#1785)
* fix: fix Steam Valve not being configurable * Revert "fix: fix Steam Valve not being configurable" This reverts commit 505d9e273b48315fde154490e116d58fed46ffaf. * feat: add steam regulator * feat: add superheated steam to steam valve
Diffstat (limited to 'src/main/java/gregtech/common/covers')
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java10
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_SteamRegulator.java26
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_SteamValve.java2
3 files changed, 34 insertions, 4 deletions
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java b/src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java
index df0b16c297..b02610ebf4 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java
@@ -36,13 +36,13 @@ import io.netty.buffer.ByteBuf;
/**
* Cover variable
- *
+ *
* <pre>
* 1111 1111 1111 1111 1111 1111 1111 1111
* |- interval-| |- flow rate 2 compl. -|
* ^ export?
* </pre>
- *
+ *
* Concat export and flow rate 2 compl. together to get actual flow rate. A positive actual flow rate is export, and
* vice versa.
* <p>
@@ -123,7 +123,7 @@ public class GT_Cover_FluidRegulator extends GT_CoverBehaviorBase<GT_Cover_Fluid
if (tTank1 != null && tTank2 != null) {
allowFluid = true;
FluidStack tLiquid = tTank1.drain(directionFrom, Math.abs(aCoverVariable.speed), false);
- if (tLiquid != null) {
+ if (tLiquid != null && this.canTransferFluid(tLiquid)) {
tLiquid = tLiquid.copy();
tLiquid.amount = tTank2.fill(directionTo, tLiquid, false);
if (tLiquid.amount > 0) {
@@ -184,6 +184,10 @@ public class GT_Cover_FluidRegulator extends GT_CoverBehaviorBase<GT_Cover_Fluid
return true;
}
+ protected boolean canTransferFluid(FluidStack fluid) {
+ return true;
+ }
+
@Override
public boolean letsRedstoneGoInImpl(byte aSide, int aCoverID, FluidRegulatorData aCoverVariable,
ICoverable aTileEntity) {
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_SteamRegulator.java b/src/main/java/gregtech/common/covers/GT_Cover_SteamRegulator.java
new file mode 100644
index 0000000000..e9081006e2
--- /dev/null
+++ b/src/main/java/gregtech/common/covers/GT_Cover_SteamRegulator.java
@@ -0,0 +1,26 @@
+package gregtech.common.covers;
+
+import net.minecraftforge.fluids.FluidStack;
+
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.util.GT_ModHandler;
+
+public class GT_Cover_SteamRegulator extends GT_Cover_FluidRegulator {
+
+ /**
+ * @deprecated use {@link #GT_Cover_SteamRegulator(int aTransferRate, ITexture coverTexture)} instead
+ */
+ @Deprecated
+ public GT_Cover_SteamRegulator(int aTransferRate) {
+ this(aTransferRate, null);
+ }
+
+ public GT_Cover_SteamRegulator(int aTransferRate, ITexture coverTexture) {
+ super(aTransferRate, coverTexture);
+ }
+
+ @Override
+ protected boolean canTransferFluid(FluidStack fluid) {
+ return GT_ModHandler.isAnySteam(fluid) || GT_ModHandler.isSuperHeatedSteam(fluid);
+ }
+}
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_SteamValve.java b/src/main/java/gregtech/common/covers/GT_Cover_SteamValve.java
index 916f5ed75e..0c24e135f1 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_SteamValve.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_SteamValve.java
@@ -28,6 +28,6 @@ public class GT_Cover_SteamValve extends GT_Cover_Pump {
@Override
protected boolean canTransferFluid(FluidStack fluid) {
- return GT_ModHandler.isAnySteam(fluid);
+ return GT_ModHandler.isAnySteam(fluid) || GT_ModHandler.isSuperHeatedSteam(fluid);
}
}