aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/covers/GT_Cover_Pump.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/common/covers/GT_Cover_Pump.java')
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_Pump.java285
1 files changed, 129 insertions, 156 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 6f1cbabd2c..52170883c7 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_Pump.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_Pump.java
@@ -11,177 +11,150 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
public class GT_Cover_Pump
- extends GT_CoverBehavior
-{
- public final int mTransferRate;
-
- public GT_Cover_Pump(int aTransferRate)
- {
- this.mTransferRate = aTransferRate;
- }
-
- public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer)
- {
- if ((aCoverVariable % 6 > 1) && ((aTileEntity instanceof IMachineProgress))) {
- if (((IMachineProgress)aTileEntity).isAllowedToWork() != aCoverVariable % 6 < 4) {
- return aCoverVariable;
- }
+ extends GT_CoverBehavior {
+ public final int mTransferRate;
+
+ public GT_Cover_Pump(int aTransferRate) {
+ this.mTransferRate = aTransferRate;
}
- if ((aTileEntity instanceof IFluidHandler))
- {
- IFluidHandler tTank2 = aTileEntity.getITankContainerAtSide(aSide);
- if (tTank2 != null)
- {
- aTileEntity.decreaseStoredEnergyUnits(GT_Utility.getTier(this.mTransferRate), true);
- IFluidHandler tTank1 = (IFluidHandler)aTileEntity;
- if (aCoverVariable % 2 == 0)
- {
- FluidStack tLiquid = tTank1.drain(ForgeDirection.getOrientation(aSide), this.mTransferRate, false);
- if (tLiquid != null)
- {
- tLiquid = tLiquid.copy();
- tLiquid.amount = tTank2.fill(ForgeDirection.getOrientation(aSide).getOpposite(), tLiquid, false);
- if (tLiquid.amount > 0) {
- if (((aCoverVariable % 2 != 1) || (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);
- tTank2.fill(ForgeDirection.getOrientation(aSide).getOpposite(), tTank1.drain(ForgeDirection.getOrientation(aSide), tLiquid.amount, true), true);
- }
- }
- else {
- tTank2.fill(ForgeDirection.getOrientation(aSide).getOpposite(), tTank1.drain(ForgeDirection.getOrientation(aSide), tLiquid.amount, true), true);
- }
+
+ public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ if ((aCoverVariable % 6 > 1) && ((aTileEntity instanceof IMachineProgress))) {
+ if (((IMachineProgress) aTileEntity).isAllowedToWork() != aCoverVariable % 6 < 4) {
+ return aCoverVariable;
}
- }
- }
- else
- {
- FluidStack tLiquid = tTank2.drain(ForgeDirection.getOrientation(aSide).getOpposite(), this.mTransferRate, false);
- if (tLiquid != null)
- {
- tLiquid = tLiquid.copy();
- tLiquid.amount = tTank1.fill(ForgeDirection.getOrientation(aSide), tLiquid, false);
- if (tLiquid.amount > 0) {
- if (((aCoverVariable % 2 != 1) || (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);
- tTank1.fill(ForgeDirection.getOrientation(aSide), tTank2.drain(ForgeDirection.getOrientation(aSide).getOpposite(), tLiquid.amount, true), true);
+ }
+ if ((aTileEntity instanceof IFluidHandler)) {
+ IFluidHandler tTank2 = aTileEntity.getITankContainerAtSide(aSide);
+ if (tTank2 != null) {
+ aTileEntity.decreaseStoredEnergyUnits(GT_Utility.getTier(this.mTransferRate), true);
+ IFluidHandler tTank1 = (IFluidHandler) aTileEntity;
+ if (aCoverVariable % 2 == 0) {
+ FluidStack tLiquid = tTank1.drain(ForgeDirection.getOrientation(aSide), this.mTransferRate, false);
+ if (tLiquid != null) {
+ tLiquid = tLiquid.copy();
+ tLiquid.amount = tTank2.fill(ForgeDirection.getOrientation(aSide).getOpposite(), tLiquid, false);
+ if (tLiquid.amount > 0) {
+ if (((aCoverVariable % 2 != 1) || (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);
+ tTank2.fill(ForgeDirection.getOrientation(aSide).getOpposite(), tTank1.drain(ForgeDirection.getOrientation(aSide), tLiquid.amount, true), true);
+ }
+ } else {
+ tTank2.fill(ForgeDirection.getOrientation(aSide).getOpposite(), tTank1.drain(ForgeDirection.getOrientation(aSide), tLiquid.amount, true), true);
+ }
+ }
+ }
+ } else {
+ FluidStack tLiquid = tTank2.drain(ForgeDirection.getOrientation(aSide).getOpposite(), this.mTransferRate, false);
+ if (tLiquid != null) {
+ tLiquid = tLiquid.copy();
+ tLiquid.amount = tTank1.fill(ForgeDirection.getOrientation(aSide), tLiquid, false);
+ if (tLiquid.amount > 0) {
+ if (((aCoverVariable % 2 != 1) || (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);
+ tTank1.fill(ForgeDirection.getOrientation(aSide), tTank2.drain(ForgeDirection.getOrientation(aSide).getOpposite(), tLiquid.amount, true), true);
+ }
+ } else {
+ tTank1.fill(ForgeDirection.getOrientation(aSide), tTank2.drain(ForgeDirection.getOrientation(aSide).getOpposite(), tLiquid.amount, true), true);
+ }
+ }
+ }
}
- }
- else {
- tTank1.fill(ForgeDirection.getOrientation(aSide), tTank2.drain(ForgeDirection.getOrientation(aSide).getOpposite(), tLiquid.amount, true), true);
- }
}
- }
}
- }
- }
- return aCoverVariable;
- }
-
- public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ)
- {
- aCoverVariable = (aCoverVariable + 1) % 12;
- if (aCoverVariable == 0) {
- GT_Utility.sendChatToPlayer(aPlayer, "Export");
- }
- if (aCoverVariable == 1) {
- GT_Utility.sendChatToPlayer(aPlayer, "Import");
- }
- if (aCoverVariable == 2) {
- GT_Utility.sendChatToPlayer(aPlayer, "Export (conditional)");
+ return aCoverVariable;
}
- if (aCoverVariable == 3) {
- GT_Utility.sendChatToPlayer(aPlayer, "Import (conditional)");
+
+ public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ aCoverVariable = (aCoverVariable + 1) % 12;
+ if (aCoverVariable == 0) {
+ GT_Utility.sendChatToPlayer(aPlayer, "Export");
+ }
+ if (aCoverVariable == 1) {
+ GT_Utility.sendChatToPlayer(aPlayer, "Import");
+ }
+ if (aCoverVariable == 2) {
+ GT_Utility.sendChatToPlayer(aPlayer, "Export (conditional)");
+ }
+ if (aCoverVariable == 3) {
+ GT_Utility.sendChatToPlayer(aPlayer, "Import (conditional)");
+ }
+ if (aCoverVariable == 4) {
+ GT_Utility.sendChatToPlayer(aPlayer, "Export (invert cond)");
+ }
+ if (aCoverVariable == 5) {
+ GT_Utility.sendChatToPlayer(aPlayer, "Import (invert cond)");
+ }
+ if (aCoverVariable == 6) {
+ GT_Utility.sendChatToPlayer(aPlayer, "Export allow Input");
+ }
+ if (aCoverVariable == 7) {
+ GT_Utility.sendChatToPlayer(aPlayer, "Import allow Output");
+ }
+ if (aCoverVariable == 8) {
+ GT_Utility.sendChatToPlayer(aPlayer, "Export allow Input (conditional)");
+ }
+ if (aCoverVariable == 9) {
+ GT_Utility.sendChatToPlayer(aPlayer, "Import allow Output (conditional)");
+ }
+ if (aCoverVariable == 10) {
+ GT_Utility.sendChatToPlayer(aPlayer, "Export allow Input (invert cond)");
+ }
+ if (aCoverVariable == 11) {
+ GT_Utility.sendChatToPlayer(aPlayer, "Import allow Output (invert cond)");
+ }
+ return aCoverVariable;
}
- if (aCoverVariable == 4) {
- GT_Utility.sendChatToPlayer(aPlayer, "Export (invert cond)");
+
+ public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return true;
}
- if (aCoverVariable == 5) {
- GT_Utility.sendChatToPlayer(aPlayer, "Import (invert cond)");
+
+ public boolean letsRedstoneGoOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return true;
}
- if (aCoverVariable == 6) {
- GT_Utility.sendChatToPlayer(aPlayer, "Export allow Input");
+
+ public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return true;
}
- if (aCoverVariable == 7) {
- GT_Utility.sendChatToPlayer(aPlayer, "Import allow Output");
+
+ public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return true;
}
- if (aCoverVariable == 8) {
- GT_Utility.sendChatToPlayer(aPlayer, "Export allow Input (conditional)");
+
+ public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) {
+ return true;
}
- if (aCoverVariable == 9) {
- GT_Utility.sendChatToPlayer(aPlayer, "Import allow Output (conditional)");
+
+ public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) {
+ return true;
}
- if (aCoverVariable == 10) {
- GT_Utility.sendChatToPlayer(aPlayer, "Export allow Input (invert cond)");
+
+ public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) {
+ if ((aCoverVariable > 1) && ((aTileEntity instanceof IMachineProgress))) {
+ if (((IMachineProgress) aTileEntity).isAllowedToWork() != aCoverVariable % 6 < 4) {
+ return false;
+ }
+ }
+ return (aCoverVariable >= 6) || (aCoverVariable % 2 != 0);
}
- if (aCoverVariable == 11) {
- GT_Utility.sendChatToPlayer(aPlayer, "Import allow Output (invert cond)");
+
+ public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) {
+ if ((aCoverVariable > 1) && ((aTileEntity instanceof IMachineProgress))) {
+ if (((IMachineProgress) aTileEntity).isAllowedToWork() != aCoverVariable % 6 < 4) {
+ return false;
+ }
+ }
+ return (aCoverVariable >= 6) || (aCoverVariable % 2 == 0);
}
- return aCoverVariable;
- }
-
- public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity)
- {
- return true;
- }
-
- public boolean letsRedstoneGoOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity)
- {
- return true;
- }
-
- public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity)
- {
- return true;
- }
-
- public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity)
- {
- return true;
- }
-
- public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity)
- {
- return true;
- }
-
- public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity)
- {
- return true;
- }
-
- public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity)
- {
- if ((aCoverVariable > 1) && ((aTileEntity instanceof IMachineProgress))) {
- if (((IMachineProgress)aTileEntity).isAllowedToWork() != aCoverVariable % 6 < 4) {
- return false;
- }
+
+ public boolean alwaysLookConnected(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return true;
}
- return (aCoverVariable >= 6) || (aCoverVariable % 2 != 0);
- }
-
- public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity)
- {
- if ((aCoverVariable > 1) && ((aTileEntity instanceof IMachineProgress))) {
- if (((IMachineProgress)aTileEntity).isAllowedToWork() != aCoverVariable % 6 < 4) {
- return false;
- }
+
+ public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return 1;
}
- return (aCoverVariable >= 6) || (aCoverVariable % 2 == 0);
- }
-
- public boolean alwaysLookConnected(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity)
- {
- return true;
- }
-
- public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity)
- {
- return 1;
- }
}