Skip to content

Commit

Permalink
Update ClientEvents.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
HollowHorizon authored Aug 30, 2024
1 parent 189ef2b commit 5e30486
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ object ClientEvents {

@SubscribeEvent
fun onScreenOpen(event: ScreenEvent.Opening) {
if (event.screen is TitleScreen && !ignoreOptifine && ModList.get().isLoaded("optifine")) {
if (event.screen is TitleScreen && !ignoreOptifine && hasOptifine()) {
event.newScreen = ImGuiScreen {
ImGui.getBackgroundDrawList()
.addRectFilled(0f, 0f, width, height, ImGui.colorConvertFloat4ToU32(0f, 0f, 0f, 1f))
Expand All @@ -105,6 +105,16 @@ object ClientEvents {
}
}

fun hasOptifine(): Boolean {
Class<?> clazz = null;
try {
clazz = Class.forName("net.optifine.shaders.Shaders");
} catch (ClassNotFoundException e) {
// Оптифайна нет
}
return = clazz != null;
}

@SubscribeEvent
fun renderOverlay(event: RenderGuiOverlayEvent.Post) {
if (event.overlay != VanillaGuiOverlay.HOTBAR.type()) return
Expand Down

0 comments on commit 5e30486

Please sign in to comment.