mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-04 23:47:59 +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
|
* @param position the new position
|
||||||
* @see #sendPositionUpdate(boolean)
|
* @see #sendPositionUpdate(boolean)
|
||||||
*/
|
*/
|
||||||
@ApiStatus.Internal
|
@ApiStatus.Internal
|
||||||
public void refreshPosition(@NotNull final Pos position, boolean ignoreView) {
|
public void refreshPosition(@NotNull final Pos position, boolean ignoreView) {
|
||||||
|
if (!position.samePoint(this.position)) {
|
||||||
|
refreshCoordinate(position);
|
||||||
|
}
|
||||||
if (!ignoreView) {
|
if (!ignoreView) {
|
||||||
this.position = position;
|
this.position = position;
|
||||||
} else {
|
} else {
|
||||||
this.position = this.position.withCoord(position);
|
this.position = this.position.withCoord(position);
|
||||||
}
|
}
|
||||||
if (!position.samePoint(this.position)) {
|
|
||||||
refreshCoordinate(position);
|
|
||||||
}
|
|
||||||
sendPositionUpdate(true);
|
sendPositionUpdate(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,6 @@ public final class Pos implements Point {
|
|||||||
* x = -Opp
|
* x = -Opp
|
||||||
* z = Adj
|
* z = Adj
|
||||||
*/
|
*/
|
||||||
final double _2PI = 2 * Math.PI;
|
|
||||||
final double x = point.x();
|
final double x = point.x();
|
||||||
final double z = point.z();
|
final double z = point.z();
|
||||||
if (x == 0 && z == 0) {
|
if (x == 0 && z == 0) {
|
||||||
@ -81,6 +80,7 @@ public final class Pos implements Point {
|
|||||||
}
|
}
|
||||||
final double theta = Math.atan2(-x, z);
|
final double theta = Math.atan2(-x, z);
|
||||||
final double xz = Math.sqrt(MathUtils.square(x) + MathUtils.square(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),
|
return withView((float) Math.toDegrees((theta + _2PI) % _2PI),
|
||||||
(float) Math.toDegrees(Math.atan(-point.y() / xz)));
|
(float) Math.toDegrees(Math.atan(-point.y() / xz)));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user