code reformat

This commit is contained in:
2024-10-15 20:40:45 +02:00
parent 796bee9696
commit 03c26bc2f9
18 changed files with 120 additions and 96 deletions

View File

@@ -7,7 +7,7 @@ import java.util.function.Consumer;
public class LocationUtil {
public static void iterateBlocks(Location loc1, Location loc2, Consumer<Location> action) {
if (loc1.getWorld() != loc2.getWorld()) {
if(loc1.getWorld() != loc2.getWorld()) {
throw new IllegalArgumentException("Locations must be in the same world");
}
@@ -19,9 +19,9 @@ public class LocationUtil {
int minZ = Math.min(loc1.getBlockZ(), loc2.getBlockZ());
int maxZ = Math.max(loc1.getBlockZ(), loc2.getBlockZ());
for (int x = minX; x <= maxX; x++) {
for (int y = minY; y <= maxY; y++) {
for (int z = minZ; z <= maxZ; z++) {
for(int x = minX; x <= maxX; x++) {
for(int y = minY; y <= maxY; y++) {
for(int z = minZ; z <= maxZ; z++) {
action.accept(new Location(world, x, y, z));
}
}

View File

@@ -8,6 +8,7 @@ public class MinMaxUtil {
public static <I, O extends Comparable<O>> O getMinProperty(List<I> list, Function<I, O> supplier) {
return supplier.apply(list.stream().min(Comparator.comparing(supplier)).orElseThrow());
}
public static <I, O extends Comparable<O>> O getMaxProperty(List<I> list, Function<I, O> supplier) {
return supplier.apply(list.stream().max(Comparator.comparing(supplier)).orElseThrow());
}