13
0

Fix packet stuff
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2022-03-26 13:57:30 +01:00
Ursprung 14c3be143d
Commit be861b6bbf

Datei anzeigen

@ -161,6 +161,9 @@ public class NPC {
}
public void setLocation(Location location) {
if (isSimilarLocation(location)) {
return;
}
this.location = location;
byte yaw = (byte)(int)(location.getYaw() * 256.0 / 360.0);
headRotationYaw.set(headRotation, yaw);
@ -175,6 +178,25 @@ public class NPC {
display.setLocation(location);
}
private boolean isSimilarLocation(Location location) {
if (Location.normalizeYaw(this.location.getYaw()) != Location.normalizeYaw(location.getYaw())) {
return false;
}
if (Location.normalizePitch(this.location.getPitch()) != Location.normalizePitch(location.getPitch())) {
return false;
}
if (Math.abs(this.location.getX() - location.getX()) > 0.1) {
return false;
}
if (Math.abs(this.location.getY() - location.getY()) > 0.1) {
return false;
}
if (Math.abs(this.location.getZ() - location.getZ()) > 0.1) {
return false;
}
return true;
}
public Location getLocation() {
return location;
}