Skip to content

Commit

Permalink
Merge pull request #4530 from ZacSharp/pr/1.19.4/builder/fixPositionO…
Browse files Browse the repository at this point in the history
…utOfBounds

Handle positions going out of bounds between ticks
  • Loading branch information
leijurv authored Oct 21, 2024
2 parents 8e8cfdd + c25b132 commit 58fcf32
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/java/baritone/process/BuilderProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -719,13 +719,16 @@ private Goal assemble(BuilderCalculationContext bcc, List<BlockState> approxPlac
List<BetterBlockPos> sourceLiquids = new ArrayList<>();
List<BetterBlockPos> flowingLiquids = new ArrayList<>();
Map<BlockState, Integer> missing = new HashMap<>();
List<BetterBlockPos> outOfBounds = new ArrayList<>();
incorrectPositions.forEach(pos -> {
BlockState state = bcc.bsi.get0(pos);
if (state.getBlock() instanceof AirBlock) {
if (containsBlockState(approxPlaceable, bcc.getSchematic(pos.x, pos.y, pos.z, state))) {
BlockState desired = bcc.getSchematic(pos.x, pos.y, pos.z, state);
if (desired == null) {
outOfBounds.add(pos);
} else if (containsBlockState(approxPlaceable, desired)) {
placeable.add(pos);
} else {
BlockState desired = bcc.getSchematic(pos.x, pos.y, pos.z, state);
missing.put(desired, 1 + missing.getOrDefault(desired, 0));
}
} else {
Expand All @@ -743,6 +746,7 @@ private Goal assemble(BuilderCalculationContext bcc, List<BlockState> approxPlac
}
}
});
incorrectPositions.removeAll(outOfBounds);
List<Goal> toBreak = new ArrayList<>();
breakable.forEach(pos -> toBreak.add(breakGoal(pos, bcc)));
List<Goal> toPlace = new ArrayList<>();
Expand Down

0 comments on commit 58fcf32

Please sign in to comment.