revert static cutoff, and fix goal comparisons in splice
This commit is contained in:
parent
d2413e1677
commit
d058cbf501
@ -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
|
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);
|
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");
|
logDebug("Simplifying " + goal.getClass() + " to GoalXZ due to distance");
|
||||||
}
|
}
|
||||||
inProgress = pathfinder;
|
inProgress = pathfinder;
|
||||||
|
@ -71,7 +71,7 @@ public class SplicedPath extends PathBase {
|
|||||||
if (second == null || first == null) {
|
if (second == null || first == null) {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
if (!Objects.equals(first.getGoal(), second.getGoal())) {
|
if (!first.getGoal().toString().equals(second.getGoal().toString())) {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
if (!first.getDest().equals(second.getSrc())) {
|
if (!first.getDest().equals(second.getSrc())) {
|
||||||
|
@ -74,7 +74,7 @@ public class CustomGoalProcess extends BaritoneProcessHelper implements ICustomG
|
|||||||
public PathingCommand onTick(boolean calcFailed, boolean isSafeToCancel) {
|
public PathingCommand onTick(boolean calcFailed, boolean isSafeToCancel) {
|
||||||
switch (this.state) {
|
switch (this.state) {
|
||||||
case GOAL_SET:
|
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;
|
this.state = State.NONE;
|
||||||
}
|
}
|
||||||
return new PathingCommand(this.goal, PathingCommandType.CANCEL_AND_SET_GOAL);
|
return new PathingCommand(this.goal, PathingCommandType.CANCEL_AND_SET_GOAL);
|
||||||
|
@ -39,15 +39,14 @@ public abstract class PathBase implements IPath {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PathBase staticCutoff(Goal destination) {
|
public PathBase staticCutoff(Goal destination) {
|
||||||
int min = BaritoneAPI.getSettings().pathCutoffMinimumLength.get();
|
if (length() < BaritoneAPI.getSettings().pathCutoffMinimumLength.get()) {
|
||||||
if (length() < min) {
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
if (destination == null || destination.isInGoal(getDest())) {
|
if (destination == null || destination.isInGoal(getDest())) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
double factor = BaritoneAPI.getSettings().pathCutoffFactor.get();
|
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);
|
return new CutoffPath(this, newLength);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user