Do not retrieve all chunks when teleporting in the same chunk

This commit is contained in:
Felix Cravic 2020-12-05 16:16:25 +01:00
parent f7753ab447
commit 59b4b7996d

View File

@ -1631,7 +1631,9 @@ public class Player extends LivingEntity implements CommandSender {
@Override
public void teleport(@NotNull Position position, @Nullable Runnable callback) {
final long[] chunks = ChunkUtils.getChunksInRange(position, getChunkRange());
final boolean sameChunk = getPosition().inSameChunk(position);
final long[] chunks = sameChunk ? null :
ChunkUtils.getChunksInRange(position, getChunkRange());
teleport(position, chunks, callback);
}