diff --git a/src/main/java/dan200/computercraft/shared/integration/Optifine.java b/src/main/java/dan200/computercraft/shared/integration/Optifine.java new file mode 100644 index 000000000..4c5a7d432 --- /dev/null +++ b/src/main/java/dan200/computercraft/shared/integration/Optifine.java @@ -0,0 +1,39 @@ +/* + * This file is part of ComputerCraft - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission. + * Send enquiries to dratcliffe@gmail.com + */ +package dan200.computercraft.shared.integration; + +/** + * Detect whether Optifine is installed. + */ +public final class Optifine +{ + private static final boolean LOADED; + + static + { + boolean loaded; + try + { + Class.forName( "optifine.Installer", false, Optifine.class.getClassLoader() ); + loaded = true; + } + catch( ReflectiveOperationException | LinkageError ignore ) + { + loaded = false; + } + + LOADED = loaded; + } + + private Optifine() + { + } + + public static boolean isLoaded() + { + return LOADED; + } +} diff --git a/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorRenderer.java b/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorRenderer.java index 116a7cdd9..5998abc1c 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorRenderer.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorRenderer.java @@ -7,7 +7,7 @@ package dan200.computercraft.shared.peripheral.monitor; import dan200.computercraft.ComputerCraft; import dan200.computercraft.client.render.TileEntityMonitorRenderer; -import net.minecraftforge.fml.ModList; +import dan200.computercraft.shared.integration.Optifine; import org.lwjgl.opengl.GL; import javax.annotation.Nonnull; @@ -60,7 +60,7 @@ public enum MonitorRenderer return VBO; } - if( ModList.get().isLoaded( "optifine" ) ) + if( Optifine.isLoaded() ) { ComputerCraft.log.warn( "Optifine is loaded, assuming shaders are being used. Falling back to VBO monitor renderer." ); return VBO;