From a4f0426159749f93f3ba1cee3927700196b30d0f Mon Sep 17 00:00:00 2001 From: Technus Date: Sun, 7 May 2017 22:21:44 +0200 Subject: 8e0e516 --- .../java/gregtech/common/GT_UndergroundOil.java | 28 ++++++++++++---------- .../GT_MetaTileEntity_AdvSeismicProspector.java | 20 ++++++++-------- .../basic/GT_MetaTileEntity_SeismicProspector.java | 3 ++- 3 files changed, 28 insertions(+), 23 deletions(-) (limited to 'src/main/java/gregtech/common') diff --git a/src/main/java/gregtech/common/GT_UndergroundOil.java b/src/main/java/gregtech/common/GT_UndergroundOil.java index bc9a1331b1..a3e0962100 100644 --- a/src/main/java/gregtech/common/GT_UndergroundOil.java +++ b/src/main/java/gregtech/common/GT_UndergroundOil.java @@ -22,8 +22,9 @@ import static gregtech.common.GT_Proxy.*; * Created by Tec on 29.04.2017. */ public class GT_UndergroundOil { + public static final short DIVIDER=5000; - public static FluidStack undergroundOil(IGregTechTileEntity te,float drainSpeedCoefficient){ + public static FluidStack undergroundOil(IGregTechTileEntity te, float drainSpeedCoefficient){ return undergroundOil(te.getWorld().getChunkFromBlockCoords(te.getXCoord(),te.getZCoord()),drainSpeedCoefficient); } @@ -43,7 +44,7 @@ public class GT_UndergroundOil { int[] tInts = chunkData.get(chunk.getChunkCoordIntPair()); if(tInts==null) tInts=getDefaultChunkDataOnCreation();//init if null - else if(tInts[GTOIL]==0){ + else if(tInts[GTOIL]==0){//FAST stop //can return 0 amount stack for info :D return drainSpeedCoefficient>=0 ? null : new FluidStack(FluidRegistry.getFluid(tInts[GTOILFLUID]),0); } @@ -76,17 +77,20 @@ public class GT_UndergroundOil { } //do stuff on it if needed - if(drainSpeedCoefficient>=0) { - int actualExtractionSpeed=(int)(uoFluid.DecreasePerOperationAmountInBuckets*1000*drainSpeedCoefficient); - if(fluidInChunk.amount>actualExtractionSpeed) { - fluidInChunk.amount=actualExtractionSpeed;//give appropriate amount - tInts[GTOIL]-=actualExtractionSpeed;//diminish amount - }else if(fluidInChunk.amount>0) { - //fluidInChunk.amount= the same amount... going to return this - tInts[GTOIL]=0; - }else{ + if(drainSpeedCoefficient>=0){ + if(fluidInChunk.amount tFluids = new HashMap(); + HashMap tFluids = new HashMap<>(); try { for (int x = tLeftXBound; x <= tRightXBound; ++x) for (int z = tLeftZBound; z <= tRightZBound; ++z) { ChunkPosition tPos = new ChunkPosition(GT_Utility.getScaleCoordinates(x*16,96), 0, GT_Utility.getScaleCoordinates(z*16,96)); - FluidStack tFluid = GT_UndergroundOil.undergroundOil(getBaseMetaTileEntity(),-1); + ChunkCoordIntPair cInts = getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords(tPos.chunkPosX,tPos.chunkPosZ).getChunkCoordIntPair(); + FluidStack tFluid = GT_UndergroundOil.undergroundOil(getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords(tPos.chunkPosX,tPos.chunkPosZ),-1); if (tFluid != null) - if (tFluids.containsKey(tPos)) - { - if (tFluids.get(tPos).amount 0) - tFluids.put(tPos, tFluid); + if (tFluids.containsKey(cInts)) { + if (tFluids.get(cInts).amount fl : tFluids.entrySet()) { - aOils.put(fl.getKey().chunkPosX + "," + fl.getKey().chunkPosZ + "," + (fl.getValue().amount / 5000) + "," + fl.getValue().getLocalizedName(), fl.getValue().amount / 5000); + for (Map.Entry fl : tFluids.entrySet()) { + aOils.put(fl.getKey().chunkXPos + "," + fl.getKey().chunkZPos + "," + fl.getValue().amount + "," + fl.getValue().getLocalizedName(), fl.getValue().amount); } } catch (Exception e) { // TODO: handle exception diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java index b088e10d69..85defad0cb 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java @@ -12,6 +12,7 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.objects.ItemData; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; +import gregtech.common.GT_UndergroundOil; import gregtech.common.blocks.GT_Block_Ores_Abstract; import gregtech.common.blocks.GT_TileEntity_Ores; import ic2.core.Ic2Items; @@ -102,7 +103,7 @@ public class GT_MetaTileEntity_SeismicProspector extends GT_MetaTileEntity_Basic } } if(tStringList.size()<1){tStringList.add("No Ores found.");} - FluidStack tFluid = GT_Utility.getUndergroundOil(getBaseMetaTileEntity().getWorld(), getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord()); + FluidStack tFluid = GT_UndergroundOil.undergroundOil(getBaseMetaTileEntity(),-1); String[] tStringArray = new String[tStringList.size()]; { for (int i = 0; i < tStringArray.length; i++) { -- cgit