Skip to content

Commit

Permalink
Merge pull request #135 from LostLuma/schedule-checks-main-thread
Browse files Browse the repository at this point in the history
Always run state change checks and tasks on main thread
  • Loading branch information
LostLuma authored Oct 30, 2023
2 parents bf19370 + 961fe9c commit afff69d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/java/dynamic_fps/impl/DynamicFPSMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,15 @@ private static void checkForStateChanges() {
minecraft = Minecraft.getInstance();
}

if (minecraft.isSameThread()) {
checkForStateChanges0();
} else {
// Schedule check for the beginning of the next frame
minecraft.tell(DynamicFPSMod::checkForStateChanges0);
}
}

private static void checkForStateChanges0() {
PowerState current;

if (isDisabledInternal()) {
Expand Down

0 comments on commit afff69d

Please sign in to comment.