mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-02 14:38:26 +01:00
Fix entity chunk tracking
This commit is contained in:
parent
080efa5eba
commit
c9b2356a0b
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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)));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user