MCPcopy Index your code
hub / github.com/PaperMC/Paper / distanceSquared

Method distanceSquared

paper-api/src/main/java/org/bukkit/Location.java:571–581  ·  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

569 * @see Vector
570 */
571 public double distanceSquared(@NotNull Location o) {
572 if (o == null) {
573 throw new IllegalArgumentException("Cannot measure distance to a null location");
574 } else if (o.getWorld() == null || getWorld() == null) {
575 throw new IllegalArgumentException("Cannot measure distance to a null world");
576 } else if (o.getWorld() != getWorld()) {
577 throw new IllegalArgumentException("Cannot measure distance between " + getWorld().key().asString() + " and " + o.getWorld().key().asString());
578 }
579
580 return NumberConversions.square(x - o.x) + NumberConversions.square(y - o.y) + NumberConversions.square(z - o.z);
581 }
582
583 /**
584 * Performs scalar multiplication, multiplying all components with a

Callers 2

distanceMethod · 0.95
playEffectMethod · 0.45

Calls 5

getWorldMethod · 0.95
squareMethod · 0.95
getWorldMethod · 0.65
asStringMethod · 0.65
keyMethod · 0.65

Tested by

no test coverage detected