aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/tileentities
diff options
context:
space:
mode:
authorMartin Robertz <dream-master@gmx.net>2021-02-25 11:23:37 +0100
committerGitHub <noreply@github.com>2021-02-25 11:23:37 +0100
commite7ef4012d6df5146e68aa33b1855bf98e5caae88 (patch)
treef3a122b78378082d693f7382daccdac93a2dab66 /src/main/java/gregtech/common/tileentities
parent9c1d58b8eb2bc29b301e525e5f70c489ba1bf7b2 (diff)
parent50b05babb741306c1f14ac59b63b7b97b9f8a976 (diff)
downloadGT5-Unofficial-e7ef4012d6df5146e68aa33b1855bf98e5caae88.tar.gz
GT5-Unofficial-e7ef4012d6df5146e68aa33b1855bf98e5caae88.tar.bz2
GT5-Unofficial-e7ef4012d6df5146e68aa33b1855bf98e5caae88.zip
Merge pull request #442 from GTNewHorizons/patch-pump-idle
Prevent retract pipe when drill tip can move down
Diffstat (limited to 'src/main/java/gregtech/common/tileentities')
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java
index 0eb4092e26..52a256f5a3 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java
@@ -215,9 +215,16 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
if (!this.wasPumping) {
tMovedOneDown = moveOneDown();
if (!tMovedOneDown) {
- getBaseMetaTileEntity().disableWorking();
- if (debugBlockPump) {
- GT_Log.out.println("PUMP: Can't move. Retracting in next few ticks");
+ if (canMoveDown(getBaseMetaTileEntity().getXCoord(), Math.max(getYOfPumpHead() - 1, 1), getBaseMetaTileEntity().getZCoord())) {
+ if (debugBlockPump) {
+ GT_Log.out.println("PUMP: No pipe left. Idle for a little longer.");
+ }
+ this.mPumpTimer = 160;
+ } else {
+ getBaseMetaTileEntity().disableWorking();
+ if (debugBlockPump) {
+ GT_Log.out.println("PUMP: Can't move. Retracting in next few ticks");
+ }
}
} else if (debugBlockPump) {
GT_Log.out.println("PUMP: Moved down");
@@ -530,6 +537,21 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
this.mSecondaryPumpedBlock = null;
}
+ /** only check if block below can be replaced with pipe tip. pipe stockpile condition is ignored */
+ private boolean canMoveDown(int aX, int aY, int aZ) {
+ if (!GT_Utility.eraseBlockByFakePlayer(getFakePlayer(getBaseMetaTileEntity()), aX, aY, aZ, true)) return false;
+
+ Block aBlock = getBaseMetaTileEntity().getBlock(aX, aY, aZ);
+
+ return GT_Utility.isBlockValid(aBlock) &&
+ (aBlock == Blocks.water ||
+ aBlock == Blocks.flowing_water ||
+ aBlock == Blocks.lava ||
+ aBlock == Blocks.flowing_lava ||
+ aBlock instanceof IFluidBlock ||
+ aBlock.isAir(getBaseMetaTileEntity().getWorld(), aX, aY, aZ));
+ }
+
private boolean consumeFluid(int aX, int aY, int aZ) {
// Try to consume a fluid at a location
// Returns true if something was consumed, otherwise false