12
1

Optimize ArrowStopper #282

Geschlossen
Chaoscaot möchte 4 Commits von optimize_arrowstopper nach master mergen
Nur Änderungen aus Commit 0c9a67a28e werden angezeigt - Alle Commits anzeigen

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) {
Chaoscaot markierte diese Unterhaltung als gelöst Veraltet
Veraltet
Review

Location#distanceSquared(Location)

Location#distanceSquared(Location)
return Config.HiddenBlocks.contains(block.getType().name().toLowerCase());
}