From bab0b86b035be4501c448c110c9c9fc0ec4edf6c Mon Sep 17 00:00:00 2001 From: Pyrbu Date: Tue, 13 Jun 2023 15:29:33 +0200 Subject: [PATCH] make the functions in NpcLocation a little cleaner --- .../main/java/lol/pyr/znpcsplus/util/NpcLocation.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/api/src/main/java/lol/pyr/znpcsplus/util/NpcLocation.java b/api/src/main/java/lol/pyr/znpcsplus/util/NpcLocation.java index c233355..bd5b45c 100644 --- a/api/src/main/java/lol/pyr/znpcsplus/util/NpcLocation.java +++ b/api/src/main/java/lol/pyr/znpcsplus/util/NpcLocation.java @@ -76,9 +76,7 @@ public class NpcLocation { final double z = loc.getZ() - this.z; final double y = loc.getY() - this.y; - if (x == 0 && z == 0) { - return new NpcLocation(this.x, this.y, this.z, this.yaw, y > 0 ? -90 : 90); - } + if (x == 0 && z == 0) return new NpcLocation(this.x, this.y, this.z, this.yaw, y > 0 ? -90 : 90); double x2 = NumberConversions.square(x); double z2 = NumberConversions.square(z); @@ -96,7 +94,11 @@ public class NpcLocation { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; NpcLocation that = (NpcLocation) o; - return Double.compare(that.x, x) == 0 && Double.compare(that.y, y) == 0 && Double.compare(that.z, z) == 0 && Float.compare(that.yaw, yaw) == 0 && Float.compare(that.pitch, pitch) == 0; + return Double.compare(that.x, x) == 0 && + Double.compare(that.y, y) == 0 && + Double.compare(that.z, z) == 0 && + Float.compare(that.yaw, yaw) == 0 && + Float.compare(that.pitch, pitch) == 0; } @Override