Skip to content

Commit

Permalink
Fixed minor issue with bounds not being correctly generated making th…
Browse files Browse the repository at this point in the history
…e command not 100% reliable
  • Loading branch information
Picono435 committed Dec 27, 2022
1 parent fa71f63 commit 4660177
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private static Pair<Integer, Integer> generateCoordinates(ServerLevel world, Pla
int minDistance = (int) (player.getX() + Config.getMinDistance());
if(minDistance > world.getWorldBorder().getMaxX()) minDistance = (int) (world.getWorldBorder().getMaxX() - 10);
if(maxDistance < minDistance) maxDistance = maxDistance ^ minDistance ^ (minDistance = maxDistance);
if(maxDistance == minDistance) minDistance = minDistance + 1;
if(maxDistance == minDistance) minDistance = minDistance - 1;
x = random.ints(minDistance, maxDistance).findAny().getAsInt();
}
int z;
Expand All @@ -147,7 +147,7 @@ private static Pair<Integer, Integer> generateCoordinates(ServerLevel world, Pla
int minDistance = (int) (player.getZ() + Config.getMinDistance());
if(minDistance > world.getWorldBorder().getMaxZ()) minDistance = (int) (world.getWorldBorder().getMaxZ() - 10);
if(maxDistance < minDistance) maxDistance = maxDistance ^ minDistance ^ (minDistance = maxDistance);
if(maxDistance == minDistance) minDistance = minDistance + 1;
if(maxDistance == minDistance) minDistance = minDistance - 1;
z = random.ints(minDistance, maxDistance).findAny().getAsInt();
}
return new Pair<>(x, z);
Expand Down

0 comments on commit 4660177

Please sign in to comment.