1
0
mirror of https://github.com/cabaletta/baritone synced 2024-12-18 13:15:13 +00:00

timing meme

This commit is contained in:
Leijurv 2018-12-18 16:16:32 -08:00
parent 90d0fb7efb
commit a0ab2a8ba7
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -77,13 +77,16 @@ public final class AStarPathFinder extends AbstractNodeCostSearch implements Hel
int numMovementsConsidered = 0;
int numEmptyChunk = 0;
boolean favoring = !favored.isEmpty();
int timeCheckInterval = 1 << 6;
int pathingMaxChunkBorderFetch = Baritone.settings().pathingMaxChunkBorderFetch.get(); // grab all settings beforehand so that changing settings during pathing doesn't cause a crash or unpredictable behavior
boolean minimumImprovementRepropagation = Baritone.settings().minimumImprovementRepropagation.get();
while (!openSet.isEmpty() && numEmptyChunk < pathingMaxChunkBorderFetch && !cancelRequested) {
long now = System.nanoTime() / 1000000L;
if ((numNodes & (timeCheckInterval - 1)) == 0) { // only call this once every 64 nodes (about half a millisecond)
long now = System.nanoTime() / 1000000L; // since nanoTime is slow on windows (takes many microseconds)
if (now - failureTimeoutTime >= 0 || (!failing && now - primaryTimeoutTime >= 0)) {
break;
}
}
if (slowPath) {
try {
Thread.sleep(Baritone.settings().slowPathTimeDelayMS.<Long>get());