}
private void mainLoop() {
NetworkSystem networkSystem = CoreRegistry.get(NetworkSystem.class);
DisplayDevice display = CoreRegistry.get(DisplayDevice.class);
PerformanceMonitor.startActivity("Other");
// MAIN GAME LOOP
while (running && !display.isCloseRequested()) {
// Only process rendering and updating once a second
if (!display.isActive() && isHibernationAllowed()) {
time.setPaused(true);
Iterator<Float> updateCycles = time.tick();
while (updateCycles.hasNext()) {
updateCycles.next();
}
try {
Thread.sleep(100);
} catch (InterruptedException e) {
logger.warn("Display inactivity sleep interrupted", e);
}
display.processMessages();
time.setPaused(false);
continue;
}
processStateChanges();