add path splice option

This commit is contained in:
Leijurv 2019-04-29 11:46:21 -07:00
parent 7d9b8ee4f3
commit b338dcc9de
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
3 changed files with 14 additions and 2 deletions

View File

@ -572,6 +572,16 @@ public final class Settings {
*/
public final Setting<Boolean> walkWhileBreaking = new Setting<>(true);
/**
* When a new segment is calculated that doesn't overlap with the current one, but simply begins where the current segment ends,
* splice it on and make a longer combined path. If this setting is off, any planned segment will not be spliced and will instead
* be the "next path" in PathingBehavior, and will only start after this one ends. Turning this off hurts planning ahead,
* because the next segment will exist even if it's very short.
*
* @see #planningTickLookahead
*/
public final Setting<Boolean> splicePath = new Setting<>(true);
/**
* If we are more than 300 movements into the current path, discard the oldest segments, as they are no longer useful
*/

View File

@ -195,7 +195,9 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
current.onTick();
return;
}
current = current.trySplice(next);
if (Baritone.settings().splicePath.value) {
current = current.trySplice(next);
}
if (next != null && current.getPath().getDest().equals(next.getPath().getDest())) {
next = null;
}

View File

@ -610,7 +610,7 @@ public class PathExecutor implements IPathExecutor, Helper {
ret.costEstimateIndex = costEstimateIndex;
ret.ticksOnCurrent = ticksOnCurrent;
return ret;
}).orElse(cutIfTooLong());
}).orElseGet(this::cutIfTooLong); // dont actually call cutIfTooLong every tick if we won't actually use it, use a method reference
}
private PathExecutor cutIfTooLong() {