mirror of
https://github.com/Minestom/Minestom.git
synced 2024-06-26 06:24:54 +02:00
Fix passenger position refresh
This commit is contained in:
parent
86376d431e
commit
520c85fcdb
|
@ -1287,14 +1287,11 @@ public class Entity implements Viewable, Tickable, EventHandler<EntityEvent>, Da
|
||||||
*/
|
*/
|
||||||
@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)) {
|
final var previousPosition = this.position;
|
||||||
|
this.position = ignoreView ? previousPosition.withCoord(position) : position;
|
||||||
|
if (!position.samePoint(previousPosition)) {
|
||||||
refreshCoordinate(position);
|
refreshCoordinate(position);
|
||||||
}
|
}
|
||||||
if (!ignoreView) {
|
|
||||||
this.position = position;
|
|
||||||
} else {
|
|
||||||
this.position = this.position.withCoord(position);
|
|
||||||
}
|
|
||||||
sendPositionUpdate(true);
|
sendPositionUpdate(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1316,6 +1313,7 @@ public class Entity implements Viewable, Tickable, EventHandler<EntityEvent>, Da
|
||||||
private void refreshCoordinate(Point newPosition) {
|
private void refreshCoordinate(Point newPosition) {
|
||||||
if (hasPassenger()) {
|
if (hasPassenger()) {
|
||||||
for (Entity passenger : getPassengers()) {
|
for (Entity passenger : getPassengers()) {
|
||||||
|
passenger.position = passenger.position.withCoord(newPosition);
|
||||||
passenger.refreshCoordinate(newPosition);
|
passenger.refreshCoordinate(newPosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user