fun =)
This commit is contained in:
parent
c74c01271d
commit
b109fc7420
@ -279,7 +279,7 @@ public class MovementTraverse extends Movement {
|
||||
state.setTarget(new MovementState.MovementTarget(rot, true));
|
||||
|
||||
EnumFacing side = ctx.objectMouseOver().sideHit;
|
||||
if (Objects.equals(ctx.getSelectedBlock().orElse(null), against1) && (ctx.player().isSneaking() || Baritone.settings().assumeSafeWalk.get()) && ctx.getSelectedBlock().get().offset(side).equals(positionToPlace)) {
|
||||
if ((Objects.equals(ctx.getSelectedBlock(), dest.down()) || (Objects.equals(ctx.getSelectedBlock().orElse(null), against1) && ctx.getSelectedBlock().get().offset(side).equals(positionToPlace))) && (ctx.player().isSneaking() || Baritone.settings().assumeSafeWalk.get())) {
|
||||
return state.setInput(Input.CLICK_RIGHT, true);
|
||||
}
|
||||
if (ctx.playerRotations().isReallyCloseTo(rot)) {
|
||||
|
@ -150,13 +150,13 @@ public class BuilderProcess extends BaritoneProcessHelper {
|
||||
return new PathingCommand(null, PathingCommandType.REQUEST_PAUSE);
|
||||
}
|
||||
|
||||
Goal[] goals = assemble(bcc);
|
||||
if (goals.length == 0) {
|
||||
Goal goal = assemble(bcc);
|
||||
if (goal == null) {
|
||||
logDirect("Unable to do it =(");
|
||||
onLostControl();
|
||||
return null;
|
||||
}
|
||||
return new PathingCommandContext(new GoalComposite(goals), PathingCommandType.FORCE_REVALIDATE_GOAL_AND_PATH, bcc);
|
||||
return new PathingCommandContext(goal, PathingCommandType.FORCE_REVALIDATE_GOAL_AND_PATH, bcc);
|
||||
}
|
||||
|
||||
public boolean recalc(BuilderCalculationContext bcc) {
|
||||
@ -211,13 +211,40 @@ public class BuilderProcess extends BaritoneProcessHelper {
|
||||
}
|
||||
}
|
||||
|
||||
private Goal[] assemble(BuilderCalculationContext bcc) {
|
||||
private Goal assemble(BuilderCalculationContext bcc) {
|
||||
List<IBlockState> approxPlacable = placable();
|
||||
List<BetterBlockPos> placable = incorrectPositions.stream().filter(pos -> bcc.bsi.get0(pos).getBlock() == Blocks.AIR && approxPlacable.contains(bcc.getSchematic(pos.x, pos.y, pos.z))).collect(Collectors.toList());
|
||||
if (!placable.isEmpty()) {
|
||||
return placable.stream().filter(pos -> !placable.contains(pos.down()) && !placable.contains(pos.down(2))).map(GoalPlace::new).toArray(Goal[]::new);
|
||||
Goal[] toBreak = incorrectPositions.stream().filter(pos -> bcc.bsi.get0(pos).getBlock() != Blocks.AIR).map(GoalBreak::new).toArray(Goal[]::new);
|
||||
Goal[] toPlace = placable.stream().filter(pos -> !placable.contains(pos.down()) && !placable.contains(pos.down(2))).map(GoalPlace::new).toArray(Goal[]::new);
|
||||
|
||||
if (toPlace.length != 0) {
|
||||
return new JankyGoalComposite(new GoalComposite(toPlace), new GoalComposite(toBreak));
|
||||
}
|
||||
if (toBreak.length == 0) {
|
||||
return null;
|
||||
}
|
||||
return new GoalComposite(toBreak);
|
||||
}
|
||||
|
||||
public static class JankyGoalComposite implements Goal {
|
||||
private final Goal primary;
|
||||
private final Goal fallback;
|
||||
|
||||
public JankyGoalComposite(Goal primary, Goal fallback) {
|
||||
this.primary = primary;
|
||||
this.fallback = fallback;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isInGoal(int x, int y, int z) {
|
||||
return primary.isInGoal(x, y, z) || fallback.isInGoal(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double heuristic(int x, int y, int z) {
|
||||
return primary.heuristic(x, y, z);
|
||||
}
|
||||
return incorrectPositions.stream().filter(pos -> bcc.bsi.get0(pos).getBlock() != Blocks.AIR).map(GoalBreak::new).toArray(Goal[]::new);
|
||||
}
|
||||
|
||||
public static class GoalBreak extends GoalGetToBlock {
|
||||
|
Loading…
Reference in New Issue
Block a user