Skip to content

Commit

Permalink
Always run state change checks and tasks on main thread
Browse files Browse the repository at this point in the history
As far as I'm aware this has not caused any issues,
but I'd like the implementation to be correct just in case.
  • Loading branch information
LostLuma committed Oct 30, 2023
1 parent d5cea63 commit 961fe9c
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 @@ -176,6 +176,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 961fe9c

Please sign in to comment.