Skip to content

Commit

Permalink
Fixed issue with max-distance config not being 100% reliable
Browse files Browse the repository at this point in the history
  • Loading branch information
Picono435 committed Dec 27, 2022
1 parent f0801f0 commit fa71f63
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private static Pair<Integer, Integer> generateCoordinates(ServerLevel world, Pla
if(random.nextInt(2) == 1) {
// Calculating X coordinates from min to max
int maxDistance = Config.getMaxDistance() == 0 ? (int) world.getWorldBorder().getMinX() : (int) (player.getX() + Config.getMaxDistance());
if(maxDistance < world.getWorldBorder().getMaxX()) maxDistance = (int) world.getWorldBorder().getMinX();
if(maxDistance < world.getWorldBorder().getMinX()) maxDistance = (int) world.getWorldBorder().getMinX();
int minDistance = (int) (player.getX() - Config.getMinDistance());
if(minDistance < world.getWorldBorder().getMinX()) minDistance = (int) (world.getWorldBorder().getMinX() + 10);
if(maxDistance < minDistance) maxDistance = maxDistance ^ minDistance ^ (minDistance = maxDistance);
Expand All @@ -134,7 +134,7 @@ private static Pair<Integer, Integer> generateCoordinates(ServerLevel world, Pla
if(random.nextInt(2) == 1) {
// Calculating Z coordinates from min to max
int maxDistance = Config.getMaxDistance() == 0 ? (int) world.getWorldBorder().getMinZ() : (int) (player.getZ() + Config.getMaxDistance());
if(maxDistance < world.getWorldBorder().getMaxZ()) maxDistance = (int) world.getWorldBorder().getMinZ();
if(maxDistance < world.getWorldBorder().getMinZ()) maxDistance = (int) world.getWorldBorder().getMinZ();
int minDistance = (int) (player.getZ() - Config.getMinDistance());
if(minDistance < world.getWorldBorder().getMinZ()) minDistance = (int) (world.getWorldBorder().getMinZ() + 10);
if(maxDistance < minDistance) maxDistance = maxDistance ^ minDistance ^ (minDistance = maxDistance);
Expand Down

0 comments on commit fa71f63

Please sign in to comment.