From da5a77656445c34874b123ad693d6230cc92947d Mon Sep 17 00:00:00 2001 From: Wo0kiee Date: Tue, 27 Feb 2018 01:16:06 +0600 Subject: Adv Seismic Prospector reworked Prospects from NW to SE 9 of oilfields (6x6 chunks each) and output min-max oil amount # Conflicts: # src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java --- src/main/java/gregtech/api/util/GT_Utility.java | 45 ++++++++++++++++--------- 1 file changed, 30 insertions(+), 15 deletions(-) (limited to 'src/main/java/gregtech/api') diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index fa7d96d0d6..c6a8a6ee65 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -1940,8 +1940,7 @@ public class GT_Utility { return false; } - public static ArrayList sortByValueToList( Map map ) - { + public static ArrayList sortByValueToList( Map map ) { List> list = new LinkedList>( map.entrySet() ); Collections.sort( list, new Comparator>() @@ -2118,8 +2117,9 @@ public class GT_Utility { ArrayList tOilsTransformed = new ArrayList(aOils.size()); for (String aStr : aOils) { String[] aStats = aStr.split(","); - tOilsTransformed.add(aStats[3] + " " + aStats[2] + "L"); + tOilsTransformed.add(aStats[0] + ":" + aStats[1] + "L " + aStats[2]); } + tNBT.setString("prospection_oils", joinListToString(tOilsTransformed)); tNBT.setString("prospection_bounds", aNear + "|" + aMiddle + "|" + aRadius); @@ -2141,7 +2141,7 @@ public class GT_Utility { for (int i = 6; tDataArray.length > i; i++) { tOres += (tDataArray[i] + " "); } - tNBTList.appendTag(new NBTTagString("Prospection Data From: X" + tDataArray[0] + " Z:" + tDataArray[2] + " Dim:" + tDataArray[3] + " Produces " + tDataArray[4] + "L " + tDataArray[5] + " " + tOres)); + tNBTList.appendTag(new NBTTagString("§nProspection Data §rFrom: X" + tDataArray[0] + " Z:" + tDataArray[2] + " Dim:" + tDataArray[3] + " Produces " + tDataArray[4] + "L " + tDataArray[5] + " " + tOres)); tNBT.setTag("pages", tNBTList); } setNBT(aStack, tNBT); @@ -2161,7 +2161,7 @@ public class GT_Utility { NBTTagList tNBTList = new NBTTagList(); - String tPageText = "Advanced prospection\n" + String tPageText = "§nAdvanced prospection§r\n\n" + tPos + "\n" + "Results:\n" + "- Close Range Ores: " + (tNearOres != null ? tNearOres.length : 0) + "\n" @@ -2170,20 +2170,35 @@ public class GT_Utility { + "- Oils: " + (tOils != null ? tOils.length : 0) + "\n\n" + "Lists was sorted by volume"; tNBTList.appendTag(new NBTTagString(tPageText)); - + if (tNearOres != null) - fillBookWithList(tNBTList, "Close Range Ores%s\n\n", ", ", 20, tNearOres); + fillBookWithList(tNBTList, "§nClose Range Ores§r%s\n\n", ", ", 20, tNearOres); if (tMiddleOres != null) - fillBookWithList(tNBTList, "Mid Range Ores%s\n\n", ", ", 20, tMiddleOres); + fillBookWithList(tNBTList, "§nMid Range Ores§r%s\n\n", ", ", 20, tMiddleOres); if (tFarOres != null) - fillBookWithList(tNBTList, "Far Range Ores%s\n\n", ", ", 20, tFarOres); + fillBookWithList(tNBTList, "§nFar Range Ores§r%s\n\n", ", ", 20, tFarOres); + + tPageText = "§nOre notes§r\n\n" + + "Close range:\nR <= " + tBounds[0] + "\n" + + "Mid range:\n" + tBounds[0] + " < R <= " + tBounds[1] + "\n" + + "Far range:\n" + tBounds[1] + " < R <= " + tBounds[2] + "\n" + + "\n" + + "[F][F][F][F][F]" + "\n" + + "[F][M][M][M][F]" + "\n" + + "[F][M]§2[C]§0[M][F]" + "\n" + + "[F][M][M][M][F]" + "\n" + + "[F][F][F][F][F]"; + tNBTList.appendTag(new NBTTagString(tPageText)); + if (tOils != null) - fillBookWithList(tNBTList, "Oils%s\n\n", "\n", 9, tOils); - - tPageText = "Notes\n\n" - + "Close range:\nR <= " + tBounds[0] + "\n" - + "Mid range:\n" + tBounds[0] + " < R <= " + tBounds[1] + "\n" - + "Far range:\n" + tBounds[1] + " < R <= " + tBounds[2]; + fillBookWithList(tNBTList, "§nOils§r%s\n\n", "\n", 9, tOils); + + tPageText = "§nOil notes§r\n\n" + + "[1][2][3]" + "\n" + + "[4]§2[5]§0[6]" + "\n" + + "[7][8][9]" + "\n" + + "\n" + + "§2[5]§0 — Prospector"; tNBTList.appendTag(new NBTTagString(tPageText)); tNBT.setString("author", tPos); -- cgit From 158d67c7397f004cd2dfb1077e6322d7bd9c25b4 Mon Sep 17 00:00:00 2001 From: Wo0kiee Date: Fri, 2 Mar 2018 01:08:30 +0600 Subject: deleted formatting codes --- src/main/java/gregtech/api/util/GT_Utility.java | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/main/java/gregtech/api') diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index c6a8a6ee65..4c78cdee33 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -2141,7 +2141,7 @@ public class GT_Utility { for (int i = 6; tDataArray.length > i; i++) { tOres += (tDataArray[i] + " "); } - tNBTList.appendTag(new NBTTagString("§nProspection Data §rFrom: X" + tDataArray[0] + " Z:" + tDataArray[2] + " Dim:" + tDataArray[3] + " Produces " + tDataArray[4] + "L " + tDataArray[5] + " " + tOres)); + tNBTList.appendTag(new NBTTagString("Prospection Data From: X" + tDataArray[0] + " Z:" + tDataArray[2] + " Dim:" + tDataArray[3] + " Produces " + tDataArray[4] + "L " + tDataArray[5] + " " + tOres)); tNBT.setTag("pages", tNBTList); } setNBT(aStack, tNBT); @@ -2161,7 +2161,7 @@ public class GT_Utility { NBTTagList tNBTList = new NBTTagList(); - String tPageText = "§nAdvanced prospection§r\n\n" + String tPageText = "Advanced prospection\n\n" + tPos + "\n" + "Results:\n" + "- Close Range Ores: " + (tNearOres != null ? tNearOres.length : 0) + "\n" @@ -2172,33 +2172,33 @@ public class GT_Utility { tNBTList.appendTag(new NBTTagString(tPageText)); if (tNearOres != null) - fillBookWithList(tNBTList, "§nClose Range Ores§r%s\n\n", ", ", 20, tNearOres); + fillBookWithList(tNBTList, "Close Range Ores%s\n\n", ", ", 20, tNearOres); if (tMiddleOres != null) - fillBookWithList(tNBTList, "§nMid Range Ores§r%s\n\n", ", ", 20, tMiddleOres); + fillBookWithList(tNBTList, "Mid Range Ores%s\n\n", ", ", 20, tMiddleOres); if (tFarOres != null) - fillBookWithList(tNBTList, "§nFar Range Ores§r%s\n\n", ", ", 20, tFarOres); + fillBookWithList(tNBTList, "Far Range Ores%s\n\n", ", ", 20, tFarOres); - tPageText = "§nOre notes§r\n\n" + tPageText = "Ore notes\n\n" + "Close range:\nR <= " + tBounds[0] + "\n" + "Mid range:\n" + tBounds[0] + " < R <= " + tBounds[1] + "\n" + "Far range:\n" + tBounds[1] + " < R <= " + tBounds[2] + "\n" + "\n" + "[F][F][F][F][F]" + "\n" + "[F][M][M][M][F]" + "\n" - + "[F][M]§2[C]§0[M][F]" + "\n" + + "[F][M][C][M][F]" + "\n" + "[F][M][M][M][F]" + "\n" + "[F][F][F][F][F]"; tNBTList.appendTag(new NBTTagString(tPageText)); if (tOils != null) - fillBookWithList(tNBTList, "§nOils§r%s\n\n", "\n", 9, tOils); + fillBookWithList(tNBTList, "Oils%s\n\n", "\n", 9, tOils); - tPageText = "§nOil notes§r\n\n" + tPageText = "Oil notes\n\n" + "[1][2][3]" + "\n" - + "[4]§2[5]§0[6]" + "\n" + + "[4][5][6]" + "\n" + "[7][8][9]" + "\n" + "\n" - + "§2[5]§0 — Prospector"; + + "[5] - Prospector"; tNBTList.appendTag(new NBTTagString(tPageText)); tNBT.setString("author", tPos); -- cgit From 3434f90839b6302a8effcd00a9e7c7adfdb9d053 Mon Sep 17 00:00:00 2001 From: Wo0kiee Date: Sun, 4 Mar 2018 14:53:07 +0600 Subject: Cleanup # Conflicts: # src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java --- src/main/java/gregtech/api/util/GT_Utility.java | 2 +- .../GT_MetaTileEntity_AdvSeismicProspector.java | 44 ++++++++-------------- 2 files changed, 17 insertions(+), 29 deletions(-) (limited to 'src/main/java/gregtech/api') diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index 4c78cdee33..7e81cbb8d0 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -2117,7 +2117,7 @@ public class GT_Utility { ArrayList tOilsTransformed = new ArrayList(aOils.size()); for (String aStr : aOils) { String[] aStats = aStr.split(","); - tOilsTransformed.add(aStats[0] + ":" + aStats[1] + "L " + aStats[2]); + tOilsTransformed.add(aStats[0] + ": " + aStats[1] + "L " + aStats[2]); } tNBT.setString("prospection_oils", joinListToString(tOilsTransformed)); 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 f91be2e4d3..705f76be8e 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 @@ -155,42 +155,30 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba int xChunk = (tChunk.xPosition / range) * range - ((tChunk.xPosition < 0 && tChunk.xPosition % range != 0) ? range : 0); int zChunk = (tChunk.zPosition / range) * range - ((tChunk.zPosition < 0 && tChunk.zPosition % range != 0) ? range : 0); - HashMap tFluids = new HashMap<>(); - ArrayList minmax = new ArrayList<>(); + ArrayList minMaxValue = new ArrayList<>(); + ArrayList FluidName = new ArrayList<>(); int cInts = 0; try { - for (int x = -1; x < 2; ++x) { - for (int z = -1; z < 2; ++z) { - int min = 1000; - int max = 0; - + for (int z = -1; z <= 1; ++z) { + for (int x = -1; x <= 1; ++x) { for (int i = 0; i < range; i++) { for (int j = 0; j < range; j++) { - tChunk = getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords(xChunk + i + z * 6, zChunk + j + x * 6); + tChunk = getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords(xChunk + i + x * 6, zChunk + j + z * 6); tFluid = undergroundOilReadInformation(tChunk); if (tFluid != null) { - if (max < tFluid.amount) - max = tFluid.amount; - if (min > tFluid.amount) - min = tFluid.amount; - - if (tFluids.containsKey(cInts)) { - if (tFluids.get(cInts).amount < tFluid.amount) - tFluids.get(cInts).amount = tFluid.amount; - } else tFluids.put(cInts, tFluid); + minMaxValue.add(tFluid.amount); + FluidName.add(cInts, tFluid); } } } - cInts++; - minmax.add(min + "-" + max); - } - } + int min = Collections.min(minMaxValue); + int max = Collections.max(minMaxValue); + aOils.add(cInts + 1 + "," + min + "-" + max + "," + FluidName.get(cInts).getLocalizedName()); - int i = 0; - for (Map.Entry fl : tFluids.entrySet()) { - aOils.add(i + 1 + "," + minmax.get(i) + "," + fl.getValue().getLocalizedName()); - i++; + minMaxValue.clear(); + cInts++; + } } } catch (Exception e) { @@ -203,7 +191,7 @@ 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 aNearOres, Map aMiddleOres, Map aFarOres) { + private void prospectOres(Map aNearOres, Map aMiddleOres, Map aFarOres) { int tLeftXBound = this.getBaseMetaTileEntity().getXCoord() - radius; int tRightXBound = tLeftXBound + 2*radius; @@ -221,13 +209,13 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba prospectHole(i, k, aMiddleOres); else prospectHole(i, k, aFarOres); - } + } } private void prospectHole(int i, int k, Map aOres) { String tFoundOre; for (int j = this.getBaseMetaTileEntity().getYCoord(); j > 0; j--) { - tFoundOre = checkForOre(i, j, k); + tFoundOre = checkForOre(i, j, k); if (tFoundOre != null) countOre(aOres, tFoundOre); } -- cgit From 9bb911d1b5cf12d4f4aa7024d67c209a3c19979b Mon Sep 17 00:00:00 2001 From: Wo0kiee Date: Sun, 4 Mar 2018 16:51:30 +0600 Subject: Added description --- src/main/java/gregtech/api/util/GT_Utility.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/main/java/gregtech/api') diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index 7e81cbb8d0..8a1a7feb3d 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -2194,11 +2194,12 @@ public class GT_Utility { fillBookWithList(tNBTList, "Oils%s\n\n", "\n", 9, tOils); tPageText = "Oil notes\n\n" - + "[1][2][3]" + "\n" - + "[4][5][6]" + "\n" - + "[7][8][9]" + "\n" - + "\n" - + "[5] - Prospector"; + + "Prospects from NW to SE 324 chunks (9 oilfields) around and gives min-max amount" + "\n\n" + + "[1][2][3]" + "\n" + + "[4][5][6]" + "\n" + + "[7][8][9]" + "\n" + + "\n" + + "[5] - Prospector"; tNBTList.appendTag(new NBTTagString(tPageText)); tNBT.setString("author", tPos); -- cgit