diff options
author | Bass <tudurap.com@gmail.com> | 2019-11-26 07:10:57 +0000 |
---|---|---|
committer | Bass <tudurap.com@gmail.com> | 2019-11-26 07:10:57 +0000 |
commit | 746d3fe043e49d7ced93ac25f3fde61ce71bd517 (patch) | |
tree | ad95287a51953a73bdd9f496163385e3546d0cf8 /src | |
parent | f2ec3f2852386f6ede9538ce72cd6acfdd96acb7 (diff) | |
download | GT5-Unofficial-746d3fe043e49d7ced93ac25f3fde61ce71bd517.tar.gz GT5-Unofficial-746d3fe043e49d7ced93ac25f3fde61ce71bd517.tar.bz2 GT5-Unofficial-746d3fe043e49d7ced93ac25f3fde61ce71bd517.zip |
Range config for single block pump
Adds screwdriver range configuration to single block pumps
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java | 25 |
1 files changed, 22 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 dcb516efa5..8357dfe187 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 @@ -55,11 +55,13 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { public Block mPrimaryPumpedBlock = null; public Block mSecondaryPumpedBlock = null; + private int radiusConfig = getMaxDistanceForTier(mTier); //Pump configured radius + 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", - "Pumping Area: " + (GT_MetaTileEntity_Pump.getMaxDistanceForTier((byte)aTier) * 2 + 1) + "x" + - (GT_MetaTileEntity_Pump.getMaxDistanceForTier((byte)aTier) * 2 + 1)}); + "Maximum pumping area: " + (getMaxDistanceForTier((byte)aTier) * 2 + 1) + "x" + (getMaxDistanceForTier((byte)aTier) * 2 + 1), + "Use Screwdriver to regulate pumping area"}); } public GT_MetaTileEntity_Pump(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { @@ -84,17 +86,34 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { aNBT.setString("mPumpedBlock1", this.mPrimaryPumpedBlock == null ? "" : Block.blockRegistry.getNameForObject(this.mPrimaryPumpedBlock)); aNBT.setString("mPumpedBlock2", this.mSecondaryPumpedBlock == null ? "" : Block.blockRegistry.getNameForObject(this.mSecondaryPumpedBlock)); aNBT.setBoolean("wasPumping", wasPumping); + aNBT.setInteger("radiusConfig", radiusConfig); } public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); this.wasPumping = aNBT.getBoolean("wasPumping"); + this.radiusConfig = aNBT.getInteger("radiusConfig"); this.mPrimaryPumpedBlock = Block.getBlockFromName(aNBT.getString("mPumpedBlock1")); this.mSecondaryPumpedBlock = Block.getBlockFromName(aNBT.getString("mPumpedBlock2")); if (D1) { GT_Log.out.println("PUMP: NBT:Load - WasPumping - " + this.wasPumping + "(" + aNBT.getString("mPumpedBlock1") + ") " + this.mPrimaryPumpedBlock); } + } + + @Override + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + if (aPlayer.isSneaking()) { + if (radiusConfig > 1) { + radiusConfig--; + } + } else { + if (radiusConfig < getMaxPumpableDistance()) { + radiusConfig++; + } + } + GT_Utility.sendChatToPlayer(aPlayer, "Pumping area set to " + (radiusConfig * 2 + 1) + "x" + (radiusConfig * 2 + 1));//TODO Add translation support } @@ -351,7 +370,7 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { } private void rebuildPumpQueue(int aX, int yStart, int aZ, int yEnd) { - int mDist = this.getMaxPumpableDistance(); + int mDist = this.radiusConfig; doTickProfilingInThisTick = false; ArrayDeque<ChunkPosition> fluidsToSearch = new ArrayDeque<ChunkPosition>(); ArrayDeque<ChunkPosition> fluidsFound = new ArrayDeque<ChunkPosition>(); |