Skip to content

Commit

Permalink
Check if current location is safe before searching around
Browse files Browse the repository at this point in the history
  • Loading branch information
benwoo1110 committed Jan 13, 2025
1 parent 1f8a797 commit 874b604
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
*/
@Service
public class SimpleBlockSafety implements BlockSafety {
private static final Vector DEFAULT_VECTOR = new Vector();
private static final int DEFAULT_TOLERANCE = 6;
private static final int DEFAULT_RADIUS = 9;
private static final Set<BlockFace> AROUND_BLOCK = EnumSet.noneOf(BlockFace.class);
Expand Down Expand Up @@ -191,6 +190,10 @@ private static Location getCloserBlock(Location source, Location blockA, Locatio
}

private Location checkAboveAndBelowLocation(Location l, int tolerance, int radius) {
if (playerCanSpawnHereSafely(l)) {
// Location already safe, don't need to change
return l;
}
// Tolerance must be an even number:
if (tolerance % 2 != 0) {
tolerance += 1;
Expand Down

0 comments on commit 874b604

Please sign in to comment.