Decrease cpu load to 30%.

This commit is contained in:
EOT3000 2019-10-12 19:07:55 -04:00
parent 7a6c2b5914
commit 9965c6a389
2 changed files with 31 additions and 17 deletions

View file

@ -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();

View file

@ -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;
}