Skip to content

Commit

Permalink
Merge pull request #4529 from ZacSharp/pr/1.19.4/builder/fixEmptyShap…
Browse files Browse the repository at this point in the history
…eCrash

Don't call `shape.bounds()` on empty shapes
  • Loading branch information
leijurv authored Oct 21, 2024
2 parents f22f4ae + ea1de44 commit 8e8cfdd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/baritone/process/BuilderProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import baritone.utils.schematic.MapArtSchematic;
import baritone.utils.schematic.SelectionSchematic;
import baritone.utils.schematic.SchematicSystem;
import baritone.utils.schematic.format.defaults.LitematicaSchematic;
import baritone.utils.schematic.litematica.LitematicaHelper;
import baritone.utils.schematic.schematica.SchematicaHelper;
import com.google.common.collect.ImmutableMap;
Expand Down Expand Up @@ -77,7 +76,6 @@

import java.io.File;
import java.io.FileInputStream;
import java.nio.file.Files;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
Expand Down Expand Up @@ -373,7 +371,11 @@ private Optional<Placement> possibleToPlace(BlockState toPlace, int x, int y, in
if (!placementPlausible(new BetterBlockPos(x, y, z), toPlace)) {
continue;
}
AABB aabb = placeAgainstState.getShape(ctx.world(), placeAgainstPos).bounds();
VoxelShape shape = placeAgainstState.getShape(ctx.world(), placeAgainstPos);
if (shape.isEmpty()) {
continue;
}
AABB aabb = shape.bounds();
for (Vec3 placementMultiplier : aabbSideMultipliers(against)) {
double placeX = placeAgainstPos.x + aabb.minX * placementMultiplier.x + aabb.maxX * (1 - placementMultiplier.x);
double placeY = placeAgainstPos.y + aabb.minY * placementMultiplier.y + aabb.maxY * (1 - placementMultiplier.y);
Expand Down

0 comments on commit 8e8cfdd

Please sign in to comment.