aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGlease <4586901+Glease@users.noreply.github.com>2022-10-09 18:15:38 +0800
committerGitHub <noreply@github.com>2022-10-09 12:15:38 +0200
commit7e3b2f926c6ccf6a38b9f541aa9da371b4898bd4 (patch)
tree5d8e1e05460942bdee0ed7fa84073ab9ff563e92 /src
parente31439d0beabdc31e04722c479ddaeb3a2789de2 (diff)
downloadGT5-Unofficial-7e3b2f926c6ccf6a38b9f541aa9da371b4898bd4.tar.gz
GT5-Unofficial-7e3b2f926c6ccf6a38b9f541aa9da371b4898bd4.tar.bz2
GT5-Unofficial-7e3b2f926c6ccf6a38b9f541aa9da371b4898bd4.zip
pump no uncommanded auto retract (#1449)
Diffstat (limited to 'src')
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java29
-rw-r--r--src/main/resources/assets/gregtech/lang/en_US.lang2
2 files changed, 26 insertions, 5 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 5c06ab5bd1..213b02e223 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
@@ -59,6 +59,8 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
private int radiusConfig; // Pump configured radius
private boolean mRetractDone = false;
+ private boolean mDisallowRetract = true;
+
public GT_MetaTileEntity_Pump(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier, 3, new String[] {
"The best way to empty Oceans! Outputs on top",
@@ -68,8 +70,8 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
+ (getMaxDistanceForTier(aTier) * 2 + 1),
"Use Screwdriver to regulate pumping area",
"Use Soft Mallet to disable and retract the pipe",
- "Disable itself upon hitting rocks",
- "Disable the bottom pump to retract the pipe!"
+ "Disable the bottom pump to retract the pipe!",
+ "Use Soldering Iron to auto retract the pipe when hitting a rock",
});
radiusConfig = getMaxDistanceForTier(mTier);
}
@@ -107,6 +109,8 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
: Block.blockRegistry.getNameForObject(this.mSecondaryPumpedBlock));
aNBT.setBoolean("wasPumping", wasPumping);
aNBT.setInteger("radiusConfig", radiusConfig);
+ aNBT.setBoolean("mRetractDone", mRetractDone);
+ aNBT.setBoolean("mDisallowRetract", mDisallowRetract);
}
@Override
@@ -116,6 +120,8 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
if (aNBT.hasKey("radiusConfig")) this.radiusConfig = aNBT.getInteger("radiusConfig");
this.mPrimaryPumpedBlock = Block.getBlockFromName(aNBT.getString("mPumpedBlock1"));
this.mSecondaryPumpedBlock = Block.getBlockFromName(aNBT.getString("mPumpedBlock2"));
+ this.mRetractDone = aNBT.getBoolean("mRetractDone");
+ this.mDisallowRetract = aNBT.getBoolean("mDisallowRetract");
if (debugBlockPump) {
GT_Log.out.println("PUMP: NBT:Load - WasPumping - " + this.wasPumping + "("
@@ -127,6 +133,7 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
public void setItemNBT(NBTTagCompound aNBT) {
super.setItemNBT(aNBT);
aNBT.setInteger("radiusConfig", radiusConfig);
+ aNBT.setBoolean("mDisallowRetract", mDisallowRetract);
}
@Override
@@ -153,6 +160,18 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
}
@Override
+ public boolean onSolderingToolRightClick(
+ byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (super.onSolderingToolRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ)) return true;
+ mDisallowRetract = !mDisallowRetract;
+ GT_Utility.sendChatToPlayer(
+ aPlayer,
+ StatCollector.translateToLocal(
+ mDisallowRetract ? "GT5U.machines.autoretract.disabled" : "GT5U.machines.autoretract.enabled"));
+ return true;
+ }
+
+ @Override
public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
return new GT_Container_BasicTank(aPlayerInventory, aBaseMetaTileEntity);
}
@@ -296,7 +315,7 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
// 1) We just moved down
// 2) We were previously pumping (and possibly just reloaded)
// 3) We have an empty queue and enough time has passed
- // 4) A long while has has passed
+ // 4) A long while has passed
if (debugBlockPump) {
GT_Log.out.println("PUMP: Rebuilding pump list - Size " + this.mPumpList.size()
+ " WasPumping: " + this.wasPumping + " Timer "
@@ -370,7 +389,7 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
}
}
}
- getBaseMetaTileEntity().setActive(!this.mPumpList.isEmpty());
+ if (!mDisallowRetract) getBaseMetaTileEntity().setActive(!this.mPumpList.isEmpty());
}
if (this.mFluid != null && (aTick % 20 == 0)) {
@@ -431,7 +450,7 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
}
return false;
}
- // Try to set the block below us to a a tip
+ // Try to set the block below us to a tip
if (!GT_Utility.setBlockByFakePlayer(
getFakePlayer(getBaseMetaTileEntity()), x, yHead - 1, z, MINING_PIPE_TIP_BLOCK, 0, false)) {
if (debugBlockPump) {
diff --git a/src/main/resources/assets/gregtech/lang/en_US.lang b/src/main/resources/assets/gregtech/lang/en_US.lang
index ce99857d77..ce3f362adb 100644
--- a/src/main/resources/assets/gregtech/lang/en_US.lang
+++ b/src/main/resources/assets/gregtech/lang/en_US.lang
@@ -91,6 +91,8 @@ GT5U.MS.multismelting=Multi smelting
GT5U.machines.tier=Tier
GT5U.machines.workarea=Work Area
GT5U.machines.workareaset=Work Area set to
+GT5U.machines.autoretract.enabled=Auto retract enabled
+GT5U.machines.autoretract.disabled=Auto retract disabled
GT5U.machines.radius=radius
GT5U.machines.blocks=Blocks
GT5U.machines.chunks=Chunks