mineGoalUpdateInterval and cancelOnGoalInvalidation

This commit is contained in:
Leijurv 2018-09-15 10:34:02 -07:00
parent b5a512963d
commit a978ddec08
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 20 additions and 2 deletions

View File

@ -327,6 +327,17 @@ public class Settings {
*/ */
public Setting<Boolean> walkWhileBreaking = new Setting<>(true); public Setting<Boolean> walkWhileBreaking = new Setting<>(true);
/**
* Rescan for the goal once every 5 ticks.
* Set to 0 to disable.
*/
public Setting<Integer> mineGoalUpdateInterval = new Setting<>(5);
/**
* Cancel the current path if the goal has changed, and the path originally ended in the goal but doesn't anymore
*/
public Setting<Boolean> cancelOnGoalInvalidation = new Setting<>(true);
public final Map<String, Setting<?>> byLowerName; public final Map<String, Setting<?>> byLowerName;
public final List<Setting<?>> allSettings; public final List<Setting<?>> allSettings;

View File

@ -17,6 +17,7 @@
package baritone.behavior; package baritone.behavior;
import baritone.Baritone;
import baritone.api.behavior.Behavior; import baritone.api.behavior.Behavior;
import baritone.api.event.events.PathEvent; import baritone.api.event.events.PathEvent;
import baritone.api.event.events.TickEvent; import baritone.api.event.events.TickEvent;
@ -56,8 +57,14 @@ public final class MineBehavior extends Behavior implements Helper {
if (mining == null) { if (mining == null) {
return; return;
} }
if (event.getCount() % 5 == 0) { int mineGoalUpdateInterval = Baritone.settings().mineGoalUpdateInterval.get();
updateGoal(); if (mineGoalUpdateInterval != 0) {
if (event.getCount() % mineGoalUpdateInterval == 0) {
updateGoal();
}
}
if (!Baritone.settings().cancelOnGoalInvalidation.get()) {
return;
} }
Optional<IPath> path = PathingBehavior.INSTANCE.getPath(); Optional<IPath> path = PathingBehavior.INSTANCE.getPath();
if (!path.isPresent()) { if (!path.isPresent()) {