mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Decrease cpu load to 30%.
This commit is contained in:
parent
7a6c2b5914
commit
9965c6a389
2 changed files with 31 additions and 17 deletions
|
|
@ -62,7 +62,11 @@ public class JavaChunkDataTranslator extends PacketTranslator<ServerChunkDataPac
|
|||
levelChunkPacket.setChunkX(packet.getColumn().getX());
|
||||
levelChunkPacket.setChunkZ(packet.getColumn().getZ());
|
||||
levelChunkPacket.setData(payload);
|
||||
try {
|
||||
session.getUpstream().sendPacket(levelChunkPacket);
|
||||
} catch (Exception e) {
|
||||
//Usually a connection has been closed.
|
||||
}
|
||||
session.getChunkCache().addToCache(packet.getColumn());
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ public class ChunkUtils {
|
|||
chunkData.sections[i] = new ChunkSection();
|
||||
}
|
||||
|
||||
try {
|
||||
for (int chunkY = 0; chunkY < chunkSectionCount; chunkY++) {
|
||||
Chunk chunk = chunks[chunkY];
|
||||
|
||||
|
|
@ -43,8 +44,17 @@ public class ChunkUtils {
|
|||
9 << 4); // water id
|
||||
}
|
||||
}
|
||||
|
||||
Thread.sleep(0, 3000);
|
||||
}
|
||||
|
||||
Thread.sleep(0, 15000);
|
||||
}
|
||||
|
||||
Thread.sleep(0, 30000);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
//Shouldn't happen
|
||||
}
|
||||
return chunkData;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue