make the functions in NpcLocation a little cleaner

This commit is contained in:
Pyrbu 2023-06-13 15:29:33 +02:00
parent 5e6034d384
commit bab0b86b03

View file

@ -76,9 +76,7 @@ public class NpcLocation {
final double z = loc.getZ() - this.z; final double z = loc.getZ() - this.z;
final double y = loc.getY() - this.y; final double y = loc.getY() - this.y;
if (x == 0 && z == 0) { if (x == 0 && z == 0) return new NpcLocation(this.x, this.y, this.z, this.yaw, y > 0 ? -90 : 90);
return new NpcLocation(this.x, this.y, this.z, this.yaw, y > 0 ? -90 : 90);
}
double x2 = NumberConversions.square(x); double x2 = NumberConversions.square(x);
double z2 = NumberConversions.square(z); double z2 = NumberConversions.square(z);
@ -96,7 +94,11 @@ public class NpcLocation {
if (this == o) return true; if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false; if (o == null || getClass() != o.getClass()) return false;
NpcLocation that = (NpcLocation) o; 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 @Override