diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/client/StarboundClient.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/client/StarboundClient.kt index 7a4caa2e..2d461087 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/client/StarboundClient.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/client/StarboundClient.kt @@ -139,6 +139,8 @@ class StarboundClient : Closeable { var fullbright = true + var preciseWait = false + var clientTerminated = false private set @@ -741,14 +743,17 @@ class StarboundClient : Closeable { // try to sleep until next frame as precise as possible while (diff > 0L) { executeQueuedTasks() - - if (diff >= 1_500_000L) { - LockSupport.parkNanos(1_000_000L) - } else { - Thread.yield() - } - diff = nextRender - System.nanoTime() + + if (preciseWait) { + if (diff >= 1_500_000L) { + LockSupport.parkNanos(1_000_000L) + } else { + Thread.yield() + } + } else { + LockSupport.parkNanos(diff) + } } val mark = System.nanoTime()