Fix entity chunk tracking

This commit is contained in:
TheMode 2021-07-07 19:20:58 +02:00
parent 080efa5eba
commit c9b2356a0b
2 changed files with 5 additions and 5 deletions

View File

@ -1284,21 +1284,21 @@ public class Entity implements Viewable, Tickable, EventHandler<EntityEvent>, Da
}
/**
* Updates internal fields and sends updates
* Updates internal fields and sends updates.
*
* @param position the new position
* @see #sendPositionUpdate(boolean)
*/
@ApiStatus.Internal
public void refreshPosition(@NotNull final Pos position, boolean ignoreView) {
if (!position.samePoint(this.position)) {
refreshCoordinate(position);
}
if (!ignoreView) {
this.position = position;
} else {
this.position = this.position.withCoord(position);
}
if (!position.samePoint(this.position)) {
refreshCoordinate(position);
}
sendPositionUpdate(true);
}

View File

@ -73,7 +73,6 @@ public final class Pos implements Point {
* x = -Opp
* z = Adj
*/
final double _2PI = 2 * Math.PI;
final double x = point.x();
final double z = point.z();
if (x == 0 && z == 0) {
@ -81,6 +80,7 @@ public final class Pos implements Point {
}
final double theta = Math.atan2(-x, z);
final double xz = Math.sqrt(MathUtils.square(x) + MathUtils.square(z));
final double _2PI = 2 * Math.PI;
return withView((float) Math.toDegrees((theta + _2PI) % _2PI),
(float) Math.toDegrees(Math.atan(-point.y() / xz)));
}