12
1
Dieser Commit ist enthalten in:
Chaoscaot 2021-06-06 15:14:34 +02:00
Ursprung 988f392c4e
Commit 0c9a67a28e

Datei anzeigen

@ -65,13 +65,13 @@ public class ArrowStopper {
while (!cursor.getLocation().equals(end.getLocation())) {
BlockFace nearest = BlockFace.SELF;
double nearestDistance = getSquareDistance(cursor.getLocation(), end.getLocation());
double nearestDistance = cursor.getLocation().distanceSquared(end.getLocation());
for (BlockFace face : BLOCK_FACES) {
if(face == from) {
continue;
}
Block relative = cursor.getRelative(face);
double distance = getSquareDistance(relative.getLocation(), end.getLocation());
double distance = relative.getLocation().distanceSquared(end.getLocation());
if(distance < nearestDistance) {
nearestDistance = distance;
nearest = face;
@ -86,10 +86,6 @@ public class ArrowStopper {
return false;
}
private double getSquareDistance(Location loc1, Location loc2) {
return loc1.getX() * loc2.getX() + loc1.getY() * loc2.getY() + loc1.getZ() * loc2.getZ();
}
private boolean checkBlock(Block block) {
return Config.HiddenBlocks.contains(block.getType().name().toLowerCase());
}