1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-12-14 04:00:30 +00:00

Fix Optifine detection

I really should have tested this. And not expected Optifine to be
normal.
This commit is contained in:
Jonathan Coates 2022-05-03 11:57:35 +01:00
parent cbbab26bf3
commit 074793090d
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
2 changed files with 41 additions and 2 deletions

View File

@ -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;
}
}

View File

@ -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;