12
1

Optimize ArrowStopper #282

Geschlossen
Chaoscaot möchte 4 Commits von optimize_arrowstopper nach master mergen

Datei anzeigen

@ -61,18 +61,23 @@ public class ArrowStopper {
private boolean checkBlocks(Block start, Block end) {
Block cursor = start;
BlockFace from = BlockFace.SELF;
while (!cursor.getLocation().equals(end.getLocation())) {
BlockFace nearest = BlockFace.SELF;
double nearestDistance = cursor.getLocation().distance(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 = relative.getLocation().distance(end.getLocation());
double distance = relative.getLocation().distanceSquared(end.getLocation());
if(distance < nearestDistance) {
nearestDistance = distance;
nearest = face;
}
}
from = nearest.getOppositeFace();
cursor = cursor.getRelative(nearest);
if(checkBlock(cursor))
return true;