revert static cutoff, and fix goal comparisons in splice

This commit is contained in:
Leijurv 2018-12-03 13:34:39 -08:00
parent d2413e1677
commit d058cbf501
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
4 changed files with 5 additions and 6 deletions

View File

@ -420,7 +420,7 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
}
CalculationContext context = new CalculationContext(baritone, true); // not safe to create on the other thread, it looks up a lot of stuff in minecraft
AbstractNodeCostSearch pathfinder = createPathfinder(start, goal, current == null ? null : current.getPath(), context);
if (!Objects.equals(pathfinder.getGoal(), goal)) {
if (!Objects.equals(pathfinder.getGoal(), goal)) { // will return the exact same object if simplification didn't happen
logDebug("Simplifying " + goal.getClass() + " to GoalXZ due to distance");
}
inProgress = pathfinder;

View File

@ -71,7 +71,7 @@ public class SplicedPath extends PathBase {
if (second == null || first == null) {
return Optional.empty();
}
if (!Objects.equals(first.getGoal(), second.getGoal())) {
if (!first.getGoal().toString().equals(second.getGoal().toString())) {
return Optional.empty();
}
if (!first.getDest().equals(second.getSrc())) {

View File

@ -74,7 +74,7 @@ public class CustomGoalProcess extends BaritoneProcessHelper implements ICustomG
public PathingCommand onTick(boolean calcFailed, boolean isSafeToCancel) {
switch (this.state) {
case GOAL_SET:
if (!baritone.getPathingBehavior().isPathing() && Objects.equals(baritone.getPathingBehavior().getGoal(), this.goal)) {
if (!baritone.getPathingBehavior().isPathing() && Objects.equals(baritone.getPathingBehavior().getGoal() + "", this.goal + "")) {
this.state = State.NONE;
}
return new PathingCommand(this.goal, PathingCommandType.CANCEL_AND_SET_GOAL);

View File

@ -39,15 +39,14 @@ public abstract class PathBase implements IPath {
@Override
public PathBase staticCutoff(Goal destination) {
int min = BaritoneAPI.getSettings().pathCutoffMinimumLength.get();
if (length() < min) {
if (length() < BaritoneAPI.getSettings().pathCutoffMinimumLength.get()) {
return this;
}
if (destination == null || destination.isInGoal(getDest())) {
return this;
}
double factor = BaritoneAPI.getSettings().pathCutoffFactor.get();
int newLength = (int) ((length() - 1 - min) * factor) + min;
int newLength = (int) ((length() - 1) * factor);
return new CutoffPath(this, newLength);
}
}