Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ public static boolean isBlockOutsideWorldBorder(final World world, final int x,
return x < x1 || x > x2 || z < z1 || z > z2;
}

public static boolean isAboveNetherRoof(final World world, final int x, final int y, final int z) {
if (world.getEnvironment() != World.Environment.NETHER) {
return false;
}
return y >= world.getHighestBlockYAt(x, z);
}

public static int getXInsideWorldBorder(final World world, final int x) {
final Location center = world.getWorldBorder().getCenter();
final int radius = (int) world.getWorldBorder().getSize() / 2;
Expand Down Expand Up @@ -277,6 +284,9 @@ public static Location getSafeDestination(IEssentials ess, final Location loc) t
}
}
}
if (isAboveNetherRoof(world, x, y, z)) {
y = world.getHighestBlockYAt(x, z) - 1;
}
return new Location(world, x + 0.5, y, z + 0.5, loc.getYaw(), loc.getPitch());
}

Expand Down