Optimize entity teleport, prevent movement packets from being sent with teleport ones

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2021-09-22 01:13:05 +02:00
parent 1d8addaea6
commit 93a62ba133
1 changed files with 3 additions and 2 deletions

View File

@ -242,8 +242,9 @@ public class Entity implements Viewable, Tickable, TagHandler, PermissionHandler
public @NotNull CompletableFuture<Void> teleport(@NotNull Pos position, long @Nullable [] chunks) {
Check.stateCondition(instance == null, "You need to use Entity#setInstance before teleporting an entity!");
final Runnable endCallback = () -> {
refreshPosition(position);
previousPosition = position;
this.position = position;
this.previousPosition = position;
refreshCoordinate(position);
synchronizePosition(true);
};