MCPcopy Create free account
hub / github.com/Teneted/Tenet / distanceSquared

Method distanceSquared

src/main/java/org/bukkit/Location.java:494–504  ·  view source on GitHub ↗

Get the squared distance between this location and another. @param o The other location @return the distance @throws IllegalArgumentException for differing worlds @see Vector

(@NotNull Location o)

Source from the content-addressed store, hash-verified

492 * @see Vector
493 */
494 public double distanceSquared(@NotNull Location o) {
495 if (o == null) {
496 throw new IllegalArgumentException("Cannot measure distance to a null location");
497 } else if (o.getWorld() == null || getWorld() == null) {
498 throw new IllegalArgumentException("Cannot measure distance to a null world");
499 } else if (o.getWorld() != getWorld()) {
500 throw new IllegalArgumentException("Cannot measure distance between " + getWorld().getName() + " and " + o.getWorld().getName());
501 }
502
503 return NumberConversions.square(x - o.x) + NumberConversions.square(y - o.y) + NumberConversions.square(z - o.z);
504 }
505
506 /**
507 * Performs scalar multiplication, multiplying all components with a

Callers 1

distanceMethod · 0.95

Calls 4

getWorldMethod · 0.95
squareMethod · 0.95
getWorldMethod · 0.65
getNameMethod · 0.65

Tested by

no test coverage detected