Skip to content

Commit

Permalink
I think this is slightly less jittery
Browse files Browse the repository at this point in the history
  • Loading branch information
ah-OOG-ah committed Nov 26, 2024
1 parent f4a3d46 commit c131d31
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.gtnewhorizons.angelica.mixins.interfaces.IGameSettingsExt;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import java.util.concurrent.locks.LockSupport;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.GameSettings;
import org.lwjgl.input.Keyboard;
Expand Down Expand Up @@ -47,9 +46,8 @@ public abstract class MixinMinecraft {
if (!AngelicaConfig.sleepBeforeSwap) return;
if (isFramerateLimitBelowMax()) {
final long target = angelica$lastFrameTime + (long) (1.0 / getLimitFramerate() * 1_000_000) * 1_000;
long sleepNanos;
while ((sleepNanos = target - System.nanoTime()) > 100) {
LockSupport.parkNanos(sleepNanos);
while (target - System.nanoTime() > 100) {
Thread.yield();
}
}
}
Expand Down

0 comments on commit c131d31

Please sign in to comment.