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 (Parity with 1.19)
  • Loading branch information
Picono435 committed Dec 27, 2022
1 parent b17dd77 commit 69da5d7
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,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 @@ -143,7 +143,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 69da5d7

Please sign in to comment.