aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common
diff options
context:
space:
mode:
authorRichard Hendricks <richardhendricks@pobox.com>2019-12-16 00:28:24 -0600
committerRichard Hendricks <richardhendricks@pobox.com>2019-12-16 00:28:24 -0600
commitfabd85b1c0129e2f29c65cb0b6a3c0a114632962 (patch)
tree8719996400008c7a1701e2659208da49e7907c1a /src/main/java/gregtech/common
parent1425bbd5706b3f6397c00e10a2e68c133bc900c0 (diff)
downloadGT5-Unofficial-fabd85b1c0129e2f29c65cb0b6a3c0a114632962.tar.gz
GT5-Unofficial-fabd85b1c0129e2f29c65cb0b6a3c0a114632962.tar.bz2
GT5-Unofficial-fabd85b1c0129e2f29c65cb0b6a3c0a114632962.zip
Updated Seismic Prospector ore and oil outputs to be more useful.
Diffstat (limited to 'src/main/java/gregtech/common')
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java60
1 files changed, 27 insertions, 33 deletions
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 65cab244ba..5c0e2cbf25 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
@@ -33,8 +33,6 @@ import static gregtech.common.GT_UndergroundOil.undergroundOilReadInformation;
public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_BasicMachine {
boolean ready = false;
int radius;
- int near;
- int middle;
int step;
int cX;
int cZ;
@@ -55,9 +53,6 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba
new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE),
new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER) });
radius = aRadius;
- near = radius / 3;
- near = near + near % 2; // making near value even;
- middle = near * 2;
step = aStep;
}
@@ -74,24 +69,19 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba
+ "x"
+ radius*2
+ " ONLY blocks below prospector",
- "Near < " + near,
- "Middle < " + middle,
- "Far >= " + middle,
"Oil prospecting area 3x3 oilfields, each is 8x8 chunks"};
}
protected GT_MetaTileEntity_AdvSeismicProspector(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures,
- String aGUIName, String aNEIName, int aNear, int aMiddle, int aRadius, int aStep) {
+ String aGUIName, String aNEIName, int aRadius, int aStep) {
super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName);
radius = aRadius;
- near = aNear;
- middle = aMiddle;
step = aStep;
}
public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MetaTileEntity_AdvSeismicProspector(this.mName, this.mTier, this.mDescriptionArray, this.mTextures,
- this.mGUIName, this.mNEIName, this.near, this.middle, this.radius, this.step);
+ this.mGUIName, this.mNEIName, this.radius, this.step);
}
@Override
@@ -113,10 +103,9 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba
this.ready = false;
// prospecting ores
- HashMap<String, Integer> tNearOres = new HashMap<String, Integer>();
- HashMap<String, Integer> tMiddleOres = new HashMap<String, Integer>();
- HashMap<String, Integer> tFarOres = new HashMap<String, Integer>();
- prospectOres(tNearOres, tMiddleOres, tFarOres);
+ HashMap<String, Integer> tOres = new HashMap<String, Integer>(36);
+
+ prospectOres(tOres);
// prospecting oils
ArrayList<String> tOils = new ArrayList<String>();
@@ -129,10 +118,8 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba
this.getBaseMetaTileEntity().getZCoord(),
this.getBaseMetaTileEntity().getWorld().provider.dimensionId,
tOils,
- GT_Utility.sortByValueToList(tNearOres),
- GT_Utility.sortByValueToList(tMiddleOres),
- GT_Utility.sortByValueToList(tFarOres),
- near, middle, radius);
+ GT_Utility.sortByValueToList(tOres),
+ radius);
}
}
@@ -145,8 +132,8 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba
Chunk tChunk = getBaseMetaTileEntity().getWorld().getChunkFromBlockCoords(getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord());
int oilfieldSize = 8;
- int xChunk = (tChunk.xPosition / oilfieldSize) * oilfieldSize - ((tChunk.xPosition < 0 && tChunk.xPosition % oilfieldSize != 0) ? oilfieldSize : 0);
- int zChunk = (tChunk.zPosition / oilfieldSize) * oilfieldSize - ((tChunk.zPosition < 0 && tChunk.zPosition % oilfieldSize != 0) ? oilfieldSize : 0);
+ int xChunk = Math.floorDiv(tChunk.xPosition , oilfieldSize) * oilfieldSize - ((tChunk.xPosition < 0 && tChunk.xPosition % oilfieldSize != 0) ? oilfieldSize : 0);
+ int zChunk = Math.floorDiv(tChunk.zPosition , oilfieldSize) * oilfieldSize - ((tChunk.zPosition < 0 && tChunk.zPosition % oilfieldSize != 0) ? oilfieldSize : 0);
LinkedHashMap<ChunkCoordIntPair, FluidStack> tFluids = new LinkedHashMap<>();
int oilFieldCount = 0;
@@ -186,28 +173,35 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba
// aOils.put(x + "," + z + "," + (tFluid.amount / 5000) + "," + tFluid.getLocalizedName(), tFluid.amount / 5000);
//}
- private void prospectOres(Map<String, Integer> aNearOres, Map<String, Integer> aMiddleOres, Map<String, Integer> aFarOres) {
+ private void prospectOres(Map<String, Integer> aOres) {
int tLeftXBound = this.getBaseMetaTileEntity().getXCoord() - radius;
int tRightXBound = tLeftXBound + 2*radius;
int tLeftZBound = this.getBaseMetaTileEntity().getZCoord() - radius;
int tRightZBound = tLeftZBound + 2*radius;
- for (int i = tLeftXBound; i <= tRightXBound; i += step)
+ for (int i = tLeftXBound; i <= tRightXBound; i += step) {
+ if ( (Math.abs(i)/16-1)%3!=0 ) {
+ continue;
+ }
for (int k = tLeftZBound; k <= tRightZBound; k += step) {
+ if ( (Math.abs(k)/16-1)%3!=0 ) {
+ continue;
+ }
+
int di = Math.abs(i - this.getBaseMetaTileEntity().getXCoord());
int dk = Math.abs(k - this.getBaseMetaTileEntity().getZCoord());
- cX = (i/16)*16;
- cZ = (k/16)*16;
+ cX = (Math.floorDiv(i,16))*16;
+
+ cZ = (Math.floorDiv(k,16))*16;
+
+ String separator = (cX +8)+ "," + (cZ + 8) + " --------";
+ aOres.put(separator, 1);
+ prospectHole(i, k, aOres);
- if (di <= near && dk <= near)
- prospectHole(i, k, aNearOres);
- else if (di <= middle && dk <= middle)
- prospectHole(i, k, aMiddleOres);
- else
- prospectHole(i, k, aFarOres);
}
+ }
}
private void prospectHole(int i, int k, Map<String, Integer> aOres) {
@@ -245,7 +239,7 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba
}
private static void countOre(Map<String, Integer> map, String ore, int cCX, int cCZ) {
- ore = ore + " at " + (cCX +8)+ "," + (cCZ + 8);
+ ore = (cCX +8)+ "," + (cCZ + 8) + " has " + ore;
Integer oldCount = map.get(ore);
oldCount = (oldCount == null) ? 0 : oldCount;