Source:
public void update(float delta) { GameEngine gameEngine = context.get(GameEngine.class); EngineTime time = (EngineTime) context.get(Time.class); long startTime = time.getRealTimeInMs(); while (current != null && time.getRealTimeInMs() - startTime < 20 && !gameEngine.hasPendingState()) { try { if (current.step()) { popStep(); } } catch (Exception e) { logger.error("Error while loading {}", current, e); String errorMessage = String.format("Failed to load game. There was an error during %s.", current == null ? "the last part" : current.getMessage()); gameEngine.changeState(new StateMainMenu(errorMessage)); CrashReporter.report(e, LoggingContext.getLoggingPath()); return; } } if (current == null) { nuiManager.closeScreen(loadingScreen); nuiManager.setHUDVisible(true); context.get(GameEngine.class).changeState(new StateIngame(gameManifest, context)); } else { float progressValue = (progress + current.getExpectedCost() * current.getProgress()) / maxProgress; loadingScreen.updateStatus(current.getMessage(), progressValue); nuiManager.update(delta); if (current instanceof AwaitCharacterSpawn && !chunkGenerationStarted) { chunkGenerationStarted = true; timeLastChunkGenerated = time.getRealTimeInMs(); } if (chunkGenerationStarted) { long timeSinceLastChunk = time.getRealTimeInMs() - timeLastChunkGenerated; long chunkGenerationTimeout = config.getSystem().getChunkGenerationFailTimeoutInMs(); if (timeSinceLastChunk > chunkGenerationTimeout) { String errorMessage = "World generation timed out, check the log for more info"; gameEngine.changeState(new StateMainMenu(errorMessage)); } } } }

Target:
public void update(float delta) { GameEngine gameEngine = context.get(GameEngine.class); EngineTime time = (EngineTime) context.get(Time.class); long startTime = time.getRealTimeInMs(); while (current != null && time.getRealTimeInMs() - startTime < 20 && !gameEngine.hasPendingState()) { try { if (current.step()) { popStep(); } } catch (Exception e) { logger.error("Error while loading {}", current, e); String errorMessage = String.format("Failed to load game. There was an error during \"%s\".", current == null ? "the last part" : current.getMessage()); gameEngine.changeState(new StateMainMenu(errorMessage)); CrashReporter.report(e, LoggingContext.getLoggingPath()); return; } } if (current == null) { nuiManager.closeScreen(loadingScreen); nuiManager.setHUDVisible(true); context.get(GameEngine.class).changeState(new StateIngame(gameManifest, context)); } else { float progressValue = (progress + current.getExpectedCost() * current.getProgress()) / maxProgress; loadingScreen.updateStatus(current.getMessage(), progressValue); nuiManager.update(delta); if (current instanceof AwaitCharacterSpawn && !chunkGenerationStarted) { chunkGenerationStarted = true; timeLastChunkGenerated = time.getRealTimeInMs(); } if (chunkGenerationStarted) { long timeSinceLastChunk = time.getRealTimeInMs() - timeLastChunkGenerated; long chunkGenerationTimeout = config.getSystem().getChunkGenerationFailTimeoutInMs(); if (timeSinceLastChunk > chunkGenerationTimeout) { String errorMessage = "World generation timed out, check the log for more info"; gameEngine.changeState(new StateMainMenu(errorMessage)); } } } }