Fix censorCoordinates recalc bug
Adds `equals` and `toString` implementations where needed Replaces `toString` equality check with actual `equals` check in `forceRevalidate`
This commit is contained in:
@@ -30,10 +30,7 @@ import baritone.api.schematic.ISchematic;
|
||||
import baritone.api.schematic.IStaticSchematic;
|
||||
import baritone.api.schematic.SubstituteSchematic;
|
||||
import baritone.api.schematic.format.ISchematicFormat;
|
||||
import baritone.api.utils.BetterBlockPos;
|
||||
import baritone.api.utils.RayTraceUtils;
|
||||
import baritone.api.utils.Rotation;
|
||||
import baritone.api.utils.RotationUtils;
|
||||
import baritone.api.utils.*;
|
||||
import baritone.api.utils.input.Input;
|
||||
import baritone.pathing.movement.CalculationContext;
|
||||
import baritone.pathing.movement.Movement;
|
||||
@@ -764,6 +761,16 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
|
||||
return primary.heuristic(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
JankyGoalComposite goal = (JankyGoalComposite) o;
|
||||
if (!Objects.equals(primary, goal.primary)) return false;
|
||||
return Objects.equals(fallback, goal.fallback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "JankyComposite Primary: " + primary + " Fallback: " + fallback;
|
||||
@@ -785,6 +792,16 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
|
||||
// but any other adjacent works for breaking, including inside or below
|
||||
return super.isInGoal(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format(
|
||||
"GoalBreak{x=%s,y=%s,z=%s}",
|
||||
SettingsUtil.maybeCensor(x),
|
||||
SettingsUtil.maybeCensor(y),
|
||||
SettingsUtil.maybeCensor(z)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private Goal placementGoal(BlockPos pos, BuilderCalculationContext bcc) {
|
||||
@@ -828,6 +845,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
|
||||
this.allowSameLevel = allowSameLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInGoal(int x, int y, int z) {
|
||||
if (x == this.x && y == this.y && z == this.z) {
|
||||
return false;
|
||||
@@ -844,10 +862,30 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
|
||||
return super.isInGoal(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double heuristic(int x, int y, int z) {
|
||||
// prioritize lower y coordinates
|
||||
return this.y * 100 + super.heuristic(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!super.equals(o)) return false;
|
||||
|
||||
GoalAdjacent goal = (GoalAdjacent) o;
|
||||
if (allowSameLevel != goal.allowSameLevel) return false;
|
||||
return Objects.equals(no, goal.no);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format(
|
||||
"GoalAdjacent{x=%s,y=%s,z=%s}",
|
||||
SettingsUtil.maybeCensor(x),
|
||||
SettingsUtil.maybeCensor(y),
|
||||
SettingsUtil.maybeCensor(z)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public static class GoalPlace extends GoalBlock {
|
||||
@@ -856,10 +894,21 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
|
||||
super(placeAt.up());
|
||||
}
|
||||
|
||||
@Override
|
||||
public double heuristic(int x, int y, int z) {
|
||||
// prioritize lower y coordinates
|
||||
return this.y * 100 + super.heuristic(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format(
|
||||
"GoalPlace{x=%s,y=%s,z=%s}",
|
||||
SettingsUtil.maybeCensor(x),
|
||||
SettingsUtil.maybeCensor(y),
|
||||
SettingsUtil.maybeCensor(z)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -319,6 +319,21 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
|
||||
int zDiff = z - this.z;
|
||||
return GoalBlock.calculate(xDiff, yDiff < -1 ? yDiff + 2 : yDiff == -1 ? 0 : yDiff, zDiff);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return super.equals(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format(
|
||||
"GoalThreeBlocks{x=%s,y=%s,z=%s}",
|
||||
SettingsUtil.maybeCensor(x),
|
||||
SettingsUtil.maybeCensor(y),
|
||||
SettingsUtil.maybeCensor(z)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public List<BlockPos> droppedItemsScan() {
|
||||
|
||||
@@ -160,7 +160,7 @@ public class PathingControlManager implements IPathingControlManager {
|
||||
if (newGoal.isInGoal(current.getPath().getDest())) {
|
||||
return false;
|
||||
}
|
||||
return !newGoal.toString().equals(current.getPath().getGoal().toString());
|
||||
return !newGoal.equals(current.getPath().getGoal());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user