1
0
mirror of https://github.com/cabaletta/baritone synced 2024-12-27 09:22:20 +00:00

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);
/**
* 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 List<Setting<?>> allSettings;

View File

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