diff options
| author | KiloJoel <kilojoel@gmail.com> | 2020-12-13 19:42:44 +0000 |
|---|---|---|
| committer | KiloJoel <kilojoel@gmail.com> | 2020-12-13 19:42:44 +0000 |
| commit | 396203284ecf8d03b0c34417d13d365cd8512249 (patch) | |
| tree | b62dce1e908f0c0f635cb5ce7b96c512ca4bc150 /src/main/java/gregtech/common/covers | |
| parent | 209bd9df83e91df6c4f5ec02060087a81f433288 (diff) | |
| download | GT5-Unofficial-396203284ecf8d03b0c34417d13d365cd8512249.tar.gz GT5-Unofficial-396203284ecf8d03b0c34417d13d365cd8512249.tar.bz2 GT5-Unofficial-396203284ecf8d03b0c34417d13d365cd8512249.zip | |
added steam valve cover
Diffstat (limited to 'src/main/java/gregtech/common/covers')
| -rw-r--r-- | src/main/java/gregtech/common/covers/GT_Cover_Pump.java | 9 | ||||
| -rw-r--r-- | src/main/java/gregtech/common/covers/GT_Cover_SteamValve.java | 23 |
2 files changed, 30 insertions, 2 deletions
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Pump.java b/src/main/java/gregtech/common/covers/GT_Cover_Pump.java index a6f7d653b9..1c65fac8cd 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_Pump.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_Pump.java @@ -19,6 +19,7 @@ import net.minecraftforge.fluids.IFluidHandler; public class GT_Cover_Pump extends GT_CoverBehavior{ public final int mTransferRate; + public boolean isSteamPump; public GT_Cover_Pump(int aTransferRate) { this.mTransferRate = aTransferRate; @@ -40,7 +41,7 @@ public class GT_Cover_Pump if (tLiquid != null) { tLiquid = tLiquid.copy(); tLiquid.amount = tTank2.fill(ForgeDirection.getOrientation(aSide).getOpposite(), tLiquid, false); - if (tLiquid.amount > 0) { + if (tLiquid.amount > 0 && canTransferFluid(tLiquid)) { if (((aCoverVariable % 2 == 0) || (aSide != 1)) && ((aCoverVariable % 2 != 0) || (aSide != 0)) && (aTileEntity.getUniversalEnergyCapacity() >= Math.min(1, tLiquid.amount / 10))) { if (aTileEntity.isUniversalEnergyStored(Math.min(1, tLiquid.amount / 10))) { aTileEntity.decreaseStoredEnergyUnits(Math.min(1, tLiquid.amount / 10), true); @@ -56,7 +57,7 @@ public class GT_Cover_Pump if (tLiquid != null) { tLiquid = tLiquid.copy(); tLiquid.amount = tTank1.fill(ForgeDirection.getOrientation(aSide), tLiquid, false); - if (tLiquid.amount > 0) { + if (tLiquid.amount > 0 && canTransferFluid(tLiquid)) { if (((aCoverVariable % 2 == 0) || (aSide != 1)) && ((aCoverVariable % 2 != 0) || (aSide != 0)) && (aTileEntity.getUniversalEnergyCapacity() >= Math.min(1, tLiquid.amount / 10))) { if (aTileEntity.isUniversalEnergyStored(Math.min(1, tLiquid.amount / 10))) { aTileEntity.decreaseStoredEnergyUnits(Math.min(1, tLiquid.amount / 10), true); @@ -73,6 +74,10 @@ public class GT_Cover_Pump return aCoverVariable; } + protected boolean canTransferFluid(FluidStack fluid) { + return true; + } + public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { aCoverVariable = (aCoverVariable + (aPlayer.isSneaking()? -1 : 1)) % 12; if(aCoverVariable <0){aCoverVariable = 11;} diff --git a/src/main/java/gregtech/common/covers/GT_Cover_SteamValve.java b/src/main/java/gregtech/common/covers/GT_Cover_SteamValve.java new file mode 100644 index 0000000000..456a4b03cb --- /dev/null +++ b/src/main/java/gregtech/common/covers/GT_Cover_SteamValve.java @@ -0,0 +1,23 @@ +package gregtech.common.covers; + +import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.util.GT_ModHandler; +import net.minecraftforge.fluids.FluidStack; + +public class GT_Cover_SteamValve extends GT_Cover_Pump { + + public GT_Cover_SteamValve(int aTransferRate) { + super(aTransferRate); + } + + @Override + public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { + return super.doCoverThings(aSide, aInputRedstone, aCoverID, aCoverVariable, aTileEntity, aTimer); + } + + @Override + protected boolean canTransferFluid(FluidStack fluid) { + String fluidName = fluid.getFluid().getUnlocalizedName(fluid); + return GT_ModHandler.isSteam(fluid) || fluidName.equals("fluid.steam") || fluidName.equals("ic2.fluidSteam") || fluidName.equals("fluid.mfr.steam.still.name"); + } +} |
