aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorappable <enzospiacitelli@gmail.com>2023-04-30 10:54:28 -0700
committerGitHub <noreply@github.com>2023-04-30 19:54:28 +0200
commitae9d6aa3227dd9a35d87ebfbe99a949aae8bbfc2 (patch)
treefbd1e26ec87c308a7cd7a6e0a43cb1f8a7b43e93
parente7194adb19102fe2d5ada5f89534f1fc9d115165 (diff)
downloadNotEnoughUpdates-ae9d6aa3227dd9a35d87ebfbe99a949aae8bbfc2.tar.gz
NotEnoughUpdates-ae9d6aa3227dd9a35d87ebfbe99a949aae8bbfc2.tar.bz2
NotEnoughUpdates-ae9d6aa3227dd9a35d87ebfbe99a949aae8bbfc2.zip
Metal detector solution speed improvements (#690)
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java
index 23115c36..76f56fac 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java
@@ -148,14 +148,8 @@ public class CrystalMetalDetectorSolver {
// Delay to keep old chest location from being treated as the new chest location
if (chestRecentlyFound) {
long currentTimeMillis = System.currentTimeMillis();
- if (chestLastFoundMillis == 0) {
- chestLastFoundMillis = currentTimeMillis;
- return;
- } else if (currentTimeMillis - chestLastFoundMillis < 1000 && distToTreasure < 5.0) {
- return;
- }
-
- chestLastFoundMillis = 0;
+ if (currentTimeMillis - chestLastFoundMillis < 1000 && distToTreasure < 5.0) return;
+ chestLastFoundMillis = currentTimeMillis;
chestRecentlyFound = false;
}
@@ -204,7 +198,8 @@ public class CrystalMetalDetectorSolver {
}
static void findPossibleSolutions(double distToTreasure, Vec3Comparable playerPos, boolean centerNewlyDiscovered) {
- if (prevDistToTreasure == distToTreasure && prevPlayerPos.equals(playerPos) &&
+ if (Math.abs(prevDistToTreasure - distToTreasure) < 0.2 &&
+ prevPlayerPos.distanceTo(playerPos) <= 0.1 &&
!evaluatedPlayerPositions.containsKey(playerPos)) {
evaluatedPlayerPositions.put(playerPos, distToTreasure);
if (possibleBlocks.size() == 0) {