mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-09 01:47:54 +01:00
Fix lag spikes when loading the same chunks multiple times
This commit is contained in:
parent
6514b188fe
commit
8b0ab3d8c3
@ -89,6 +89,7 @@ public class Player extends LivingEntity implements CommandSender {
|
||||
|
||||
private DimensionType dimensionType;
|
||||
private GameMode gameMode;
|
||||
// Chunks that the player can view
|
||||
protected final Set<Chunk> viewableChunks = new CopyOnWriteArraySet<>();
|
||||
|
||||
private final AtomicInteger teleportId = new AtomicInteger();
|
||||
@ -1507,10 +1508,12 @@ public class Player extends LivingEntity implements CommandSender {
|
||||
final int chunkX = ChunkUtils.getChunkCoordX(chunkIndex);
|
||||
final int chunkZ = ChunkUtils.getChunkCoordZ(chunkIndex);
|
||||
|
||||
UnloadChunkPacket unloadChunkPacket = new UnloadChunkPacket();
|
||||
// TODO prevent the client from getting lag spikes when re-loading large chunks
|
||||
// Probably by having a distinction between visible and loaded (cache) chunks
|
||||
/*UnloadChunkPacket unloadChunkPacket = new UnloadChunkPacket();
|
||||
unloadChunkPacket.chunkX = chunkX;
|
||||
unloadChunkPacket.chunkZ = chunkZ;
|
||||
playerConnection.sendPacket(unloadChunkPacket);
|
||||
playerConnection.sendPacket(unloadChunkPacket);*/
|
||||
|
||||
final Chunk chunk = instance.getChunk(chunkX, chunkZ);
|
||||
if (chunk != null)
|
||||
|
Loading…
Reference in New Issue
Block a user