aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/utils/GuiUtils.java
blob: 92df1b1f4825bbadaaf08657cd5d2980ab3e41bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package cc.polyfrost.oneconfig.utils;

import cc.polyfrost.oneconfig.libs.universal.UScreen;
import net.minecraft.client.gui.GuiScreen;

/**
 * A class containing utility methods for working with GuiScreens.
 */
public final class GuiUtils {

    /**
     * Displays a screen after a tick, preventing mouse sync issues.
     *
     * @param screen the screen to display.
     */
    public static void displayScreen(GuiScreen screen) {
        new TickDelay(() -> UScreen.displayScreen(screen), 1);
    }

    /** Close the current open GUI screen. */
    public static void closeScreen() {
        UScreen.displayScreen(null);
    }
}