Dieser Commit ist enthalten in:
Ursprung
14c3be143d
Commit
be861b6bbf
@ -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;
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren