From 275857085d3da2a1d1a73d18949e6785fccc21cd Mon Sep 17 00:00:00 2001 From: Technus Date: Wed, 13 Sep 2017 20:49:37 +0200 Subject: Add more uo methods for reading easily, make consumption scaleable Makes the code more A ok --- .../java/gregtech/common/GT_UndergroundOil.java | 23 ++++++++++++++++------ .../GT_MetaTileEntity_AdvSeismicProspector.java | 2 +- .../basic/GT_MetaTileEntity_SeismicProspector.java | 2 +- .../multi/GT_MetaTileEntity_OilDrillBase.java | 17 ++++++++-------- 4 files changed, 28 insertions(+), 16 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 a4354a17b5..05bb338d85 100644 --- a/src/main/java/gregtech/common/GT_UndergroundOil.java +++ b/src/main/java/gregtech/common/GT_UndergroundOil.java @@ -19,6 +19,15 @@ import static gregtech.common.GT_Proxy.*; */ public class GT_UndergroundOil { public static final short DIVIDER=5000; + private static final XSTR random=new XSTR(); + + public static FluidStack undergroundOilReadInformation(IGregTechTileEntity te){ + return undergroundOil(te.getWorld().getChunkFromBlockCoords(te.getXCoord(),te.getZCoord()),-1); + } + + public static FluidStack undergroundOilReadInformation(Chunk chunk) { + return undergroundOil(chunk,-1); + } public static FluidStack undergroundOil(IGregTechTileEntity te, float drainSpeedCoefficient){ return undergroundOil(te.getWorld().getChunkFromBlockCoords(te.getXCoord(),te.getZCoord()),drainSpeedCoefficient); @@ -46,7 +55,7 @@ public class GT_UndergroundOil { } //GEN IT TO GET OBJECT... - XSTR tRandom = new XSTR(aWorld.getSeed() + aWorld.provider.dimensionId * 2 + + final XSTR tRandom = new XSTR(aWorld.getSeed() + aWorld.provider.dimensionId * 2 + (chunk.getChunkCoordIntPair().chunkXPos>>3) + 8267 * (chunk.getChunkCoordIntPair().chunkZPos>>3)); GT_UO_Fluid uoFluid = GT_Mod.gregtechproxy.mUndergroundOil.GetDimension(aWorld.provider.dimensionId).getRandomFluid(tRandom); @@ -65,8 +74,7 @@ public class GT_UndergroundOil { fluidInChunk = new FluidStack(uoFluid.getFluid(),tInts[GTOIL]); }else{ fluidInChunk = new FluidStack(uoFluid.getFluid(), uoFluid.getRandomAmount(tRandom)); - tRandom=new XSTR(); - fluidInChunk.amount=(int)((float)fluidInChunk.amount*(0.75f+(tRandom.nextFloat()/2f)));//Randomly change amounts by +/- 25% + fluidInChunk.amount=(int)((float)fluidInChunk.amount*(0.75f+(random.nextFloat()/2f)));//Randomly change amounts by +/- 25% } tInts[GTOIL]=fluidInChunk.amount; tInts[GTOILFLUID]=fluidInChunk.getFluidID(); @@ -74,15 +82,18 @@ public class GT_UndergroundOil { //do stuff on it if needed if(drainSpeedCoefficient>=0){ - if(fluidInChunk.amount