diff options
author | Technus <daniel112092@gmail.com> | 2017-05-07 22:21:44 +0200 |
---|---|---|
committer | Blood-Asp <bloodasphendrik@gmail.com> | 2017-06-01 13:22:10 +0200 |
commit | a4f0426159749f93f3ba1cee3927700196b30d0f (patch) | |
tree | b6421e8255eba3de58f09cea9fec5e83f739b7e7 /src/main/java/gregtech/common/GT_UndergroundOil.java | |
parent | a99e0d4ffbed348d229bd86e7777f6d6b6634f7f (diff) | |
download | GT5-Unofficial-a4f0426159749f93f3ba1cee3927700196b30d0f.tar.gz GT5-Unofficial-a4f0426159749f93f3ba1cee3927700196b30d0f.tar.bz2 GT5-Unofficial-a4f0426159749f93f3ba1cee3927700196b30d0f.zip |
8e0e516
Diffstat (limited to 'src/main/java/gregtech/common/GT_UndergroundOil.java')
-rw-r--r-- | src/main/java/gregtech/common/GT_UndergroundOil.java | 28 |
1 files changed, 16 insertions, 12 deletions
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<DIVIDER){ fluidInChunk=null; - tInts[GTOIL]=0;//just to be on safe side... + tInts[GTOIL]=0;//so in next access it will stop way above + }else{ + fluidInChunk.amount = (int)(fluidInChunk.amount*(double)drainSpeedCoefficient/DIVIDER);//give appropriate amount + tInts[GTOIL]-=uoFluid.DecreasePerOperationAmount;//diminish amount + } + }else{//just get info + if(fluidInChunk.amount<DIVIDER){ + fluidInChunk.amount=0;//return informative stack + tInts[GTOIL]=0;//so in next access it will stop way above + }else{ + fluidInChunk.amount=fluidInChunk.amount/DIVIDER;//give moderate extraction speed } } |