mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-17 05:31:23 +01:00
Fix position update
This commit is contained in:
parent
dbd0c302d5
commit
3abef8c9a7
@ -693,7 +693,8 @@ public class Entity implements Viewable, Tickable, EventHandler, DataContainer,
|
|||||||
*
|
*
|
||||||
* @param notFromListener {@code true} if the client triggered this action
|
* @param notFromListener {@code true} if the client triggered this action
|
||||||
*/
|
*/
|
||||||
protected void sendPositionUpdate(final boolean notFromListener) {
|
@ApiStatus.Internal
|
||||||
|
public void sendPositionUpdate(final boolean notFromListener) {
|
||||||
final boolean viewChange = !position.hasSimilarView(lastSyncedPosition);
|
final boolean viewChange = !position.hasSimilarView(lastSyncedPosition);
|
||||||
final double distanceX = Math.abs(position.getX()-lastSyncedPosition.getX());
|
final double distanceX = Math.abs(position.getX()-lastSyncedPosition.getX());
|
||||||
final double distanceY = Math.abs(position.getY()-lastSyncedPosition.getY());
|
final double distanceY = Math.abs(position.getY()-lastSyncedPosition.getY());
|
||||||
@ -1357,8 +1358,6 @@ public class Entity implements Viewable, Tickable, EventHandler, DataContainer,
|
|||||||
position.setY(y);
|
position.setY(y);
|
||||||
position.setZ(z);
|
position.setZ(z);
|
||||||
|
|
||||||
sendPositionUpdate(false);
|
|
||||||
|
|
||||||
if (hasPassenger()) {
|
if (hasPassenger()) {
|
||||||
for (Entity passenger : getPassengers()) {
|
for (Entity passenger : getPassengers()) {
|
||||||
passenger.refreshPosition(x, y, z);
|
passenger.refreshPosition(x, y, z);
|
||||||
@ -1416,8 +1415,6 @@ public class Entity implements Viewable, Tickable, EventHandler, DataContainer,
|
|||||||
this.lastPosition.setPitch(position.getPitch());
|
this.lastPosition.setPitch(position.getPitch());
|
||||||
position.setYaw(yaw);
|
position.setYaw(yaw);
|
||||||
position.setPitch(pitch);
|
position.setPitch(pitch);
|
||||||
|
|
||||||
sendPositionUpdate(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -90,6 +90,7 @@ public class PlayerPositionListener {
|
|||||||
player.refreshPosition(newPosition.getX(), newPosition.getY(), newPosition.getZ());
|
player.refreshPosition(newPosition.getX(), newPosition.getY(), newPosition.getZ());
|
||||||
player.refreshView(newPosition.getYaw(), newPosition.getPitch());
|
player.refreshView(newPosition.getYaw(), newPosition.getPitch());
|
||||||
player.refreshOnGround(onGround);
|
player.refreshOnGround(onGround);
|
||||||
|
player.sendPositionUpdate(false);
|
||||||
} else {
|
} else {
|
||||||
player.teleport(player.getPosition());
|
player.teleport(player.getPosition());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user