From 5a1eb83f49c7a287eb9d7acf257ef1e36123a95e Mon Sep 17 00:00:00 2001 From: TheMode Date: Fri, 13 Aug 2021 06:04:44 +0200 Subject: [PATCH] Check with the position field instead of the parameter --- src/main/java/net/minestom/server/entity/Entity.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/minestom/server/entity/Entity.java b/src/main/java/net/minestom/server/entity/Entity.java index fa47b4dab..56eca95f7 100644 --- a/src/main/java/net/minestom/server/entity/Entity.java +++ b/src/main/java/net/minestom/server/entity/Entity.java @@ -1115,13 +1115,14 @@ public class Entity implements Viewable, Tickable, TagHandler, PermissionHandler /** * Updates internal fields and sends updates. * - * @param position the new position + * @param newPosition the new position */ @ApiStatus.Internal - public void refreshPosition(@NotNull final Pos position, boolean ignoreView) { + public void refreshPosition(@NotNull final Pos newPosition, boolean ignoreView) { final var previousPosition = this.position; - this.position = ignoreView ? previousPosition.withCoord(position) : position; + final Pos position = ignoreView ? previousPosition.withCoord(newPosition) : newPosition; if (position.equals(lastSyncedPosition)) return; + this.position = position; if (!position.samePoint(previousPosition)) { refreshCoordinate(position); } @@ -1148,8 +1149,8 @@ public class Entity implements Viewable, Tickable, TagHandler, PermissionHandler } @ApiStatus.Internal - public void refreshPosition(@NotNull final Pos position) { - refreshPosition(position, false); + public void refreshPosition(@NotNull final Pos newPosition) { + refreshPosition(newPosition, false); } /**