From 339494f8c342afb20e99714d17f847cebd2f37da Mon Sep 17 00:00:00 2001 From: Technus Date: Wed, 13 Sep 2017 20:49:37 +0200 Subject: cherrypick --- .../GT_MetaTileEntity_AdvSeismicProspector.java | 2 +- .../basic/GT_MetaTileEntity_SeismicProspector.java | 2 +- .../multi/GT_MetaTileEntity_OilDrillBase.java | 177 +++++++++++---------- 3 files changed, 91 insertions(+), 90 deletions(-) (limited to 'src/main/java/gregtech/common/tileentities') diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java index d0ba25a327..ab5f7bd625 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java @@ -144,7 +144,7 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba { ChunkPosition tPos = new ChunkPosition(GT_Utility.getScaleCoordinates(x*16,96), 0, GT_Utility.getScaleCoordinates(z*16,96)); ChunkCoordIntPair cInts = getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords(tPos.chunkPosX,tPos.chunkPosZ).getChunkCoordIntPair(); - FluidStack tFluid = GT_UndergroundOil.undergroundOil(getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords(tPos.chunkPosX,tPos.chunkPosZ),-1); + FluidStack tFluid = GT_UndergroundOil.undergroundOilReadInformation(getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords(tPos.chunkPosX,tPos.chunkPosZ)); if (tFluid != null) if (tFluids.containsKey(cInts)) { if (tFluids.get(cInts).amount mOilFieldChunks = new ArrayList(); private int mOilId = 0; @@ -33,18 +34,18 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D @Override public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setInteger("mOilId", mOilId); + super.saveNBTData(aNBT); + aNBT.setInteger("mOilId", mOilId); } - + @Override public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - mOilId = aNBT.getInteger("mOilId"); + super.loadNBTData(aNBT); + mOilId = aNBT.getInteger("mOilId"); } - + protected String[] getDescriptionInternal(String tierSuffix) { - String casings = getCasingBlockItem().get(0).getDisplayName(); + String casings = getCasingBlockItem().get(0).getDisplayName(); return new String[]{ "Controller Block for the Oil Drilling Rig " + (tierSuffix != null ? tierSuffix : ""), "Size(WxHxD): 3x7x3", "Controller (Front middle at bottom)", @@ -59,23 +60,23 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D } - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "DrillingRig.png"); - } + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "DrillingRig.png"); + } - protected int getRangeInChunks(){ - return 0; - } - - @Override - protected boolean checkHatches() { - return !mMaintenanceHatches.isEmpty() && !mOutputHatches.isEmpty() && !mEnergyHatches.isEmpty(); - } + protected int getRangeInChunks(){ + return 0; + } - @Override - protected void setElectricityStats() { - this.mEfficiency = getCurrentEfficiency(null); + @Override + protected boolean checkHatches() { + return !mMaintenanceHatches.isEmpty() && !mOutputHatches.isEmpty() && !mEnergyHatches.isEmpty(); + } + + @Override + protected void setElectricityStats() { + this.mEfficiency = getCurrentEfficiency(null); this.mEfficiencyIncrease = 10000; //T1 = 24; T2 = 96; T3 = 384 this.mEUt = 6 * (1 << (getMinTier() << 1)); @@ -91,62 +92,62 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D this.mEUt = -this.mEUt; this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - } - - @Override - protected boolean workingDownward(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead){ - if (!tryLowerPipe()){ - if (waitForPipes()) return false; - if (tryFillChunkList()) { - float speed = .5F+(GT_Utility.getTier(getMaxInputVoltage()) - getMinTier()) *.25F; - FluidStack tFluid = pumpOil(speed); - if (tFluid != null && tFluid.amount > getTotalConfigValue()){ - this.mOutputFluids = new FluidStack[]{tFluid}; - return true; - } - } - isPickingPipes = true; - return true; - } - return true; - } - - private boolean tryFillChunkList(){ - FluidStack tFluid, tOil; - if (mOilId <= 0) { - tFluid = undergroundOil(getBaseMetaTileEntity(), -1); - if (tFluid == null) return false; - mOilId = tFluid.getFluidID(); - } - tOil = new FluidStack(FluidRegistry.getFluid(mOilId), 0); - - if (mOilFieldChunks.isEmpty()) { - Chunk tChunk = getBaseMetaTileEntity().getWorld().getChunkFromBlockCoords(getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord()); - int range = getRangeInChunks(); - int xChunk = (tChunk.xPosition / range) * range, zChunk = (tChunk.zPosition / range) * range; - int xDir = tChunk.xPosition < 0 ? -1 : 1, zDir = tChunk.zPosition < 0 ? -1 : 1; - for (int i = 0; i < range; i++) { - for (int j = 0; j < range; j++) { - tChunk = getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords(xChunk + i * xDir, zChunk + j * zDir); - tFluid = undergroundOil(tChunk, -1); - if (tOil.isFluidEqual(tFluid)) - mOilFieldChunks.add(tChunk); - } - } - } - if (mOilFieldChunks.isEmpty()) return false; - return true; - } - - private FluidStack pumpOil(float speed){ - if (mOilId <= 0) return null; - FluidStack tFluid, tOil; - tOil = new FluidStack(FluidRegistry.getFluid(mOilId), 0); - for (Chunk tChunk : mOilFieldChunks) { - tFluid = undergroundOil(getBaseMetaTileEntity(),speed); - if (tFluid == null) mOilFieldChunks.remove(tChunk); - if (tOil.isFluidEqual(tFluid)) tOil.amount += tFluid.amount; - } - return tOil.amount == 0 ? null : tOil; - } -} + } + + @Override + protected boolean workingDownward(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead){ + if (!tryLowerPipe()){ + if (waitForPipes()) return false; + if (tryFillChunkList()) { + float speed = .5F+(GT_Utility.getTier(getMaxInputVoltage()) - getMinTier()) *.25F; + FluidStack tFluid = pumpOil(speed); + if (tFluid != null && tFluid.amount > getTotalConfigValue()){ + this.mOutputFluids = new FluidStack[]{tFluid}; + return true; + } + } + isPickingPipes = true; + return true; + } + return true; + } + + private boolean tryFillChunkList(){ + FluidStack tFluid, tOil; + if (mOilId <= 0) { + tFluid = undergroundOilReadInformation(getBaseMetaTileEntity()); + if (tFluid == null) return false; + mOilId = tFluid.getFluidID(); + } + tOil = new FluidStack(FluidRegistry.getFluid(mOilId), 0); + + if (mOilFieldChunks.isEmpty()) { + Chunk tChunk = getBaseMetaTileEntity().getWorld().getChunkFromBlockCoords(getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord()); + int range = getRangeInChunks(); + int xChunk = (tChunk.xPosition / range) * range, zChunk = (tChunk.zPosition / range) * range; + int xDir = tChunk.xPosition < 0 ? -1 : 1, zDir = tChunk.zPosition < 0 ? -1 : 1; + for (int i = 0; i < range; i++) { + for (int j = 0; j < range; j++) { + tChunk = getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords(xChunk + i * xDir, zChunk + j * zDir); + tFluid = undergroundOilReadInformation(tChunk); + if (tOil.isFluidEqual(tFluid)) + mOilFieldChunks.add(tChunk); + } + } + } + if (mOilFieldChunks.isEmpty()) return false; + return true; + } + + private FluidStack pumpOil(float speed){ + if (mOilId <= 0) return null; + FluidStack tFluid, tOil; + tOil = new FluidStack(FluidRegistry.getFluid(mOilId), 0); + for (Chunk tChunk : mOilFieldChunks) { + tFluid = undergroundOil(getBaseMetaTileEntity(),speed); + if (tFluid == null) mOilFieldChunks.remove(tChunk); + if (tOil.isFluidEqual(tFluid)) tOil.amount += tFluid.amount; + } + return tOil.amount == 0 ? null : tOil; + } +} \ No newline at end of file -- cgit