Add stubbed out AbstractOptifineAccessor.getIsShaderActive()

This commit is contained in:
James Seibel
2023-10-24 20:16:11 -05:00
parent 917e532408
commit 135b950db1
@@ -24,6 +24,7 @@ import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
/**
* Contains any shared code between Optifine for Forge (official Optifine)
@@ -124,4 +125,20 @@ public abstract class AbstractOptifineAccessor implements IOptifineAccessor
return 1.0;
}
public boolean getIsShaderActive()
{
try
{
// returns null if no shader, some string if shader active
// IE "(internal)", "SEUS-v10.1-Standard.zip"
String activeShaderName = (String) Class.forName("net.optifine.shaders.Shaders").getDeclaredMethod("getShaderPackName").invoke(null);
return activeShaderName != null;
}
catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e)
{
return false;
}
}
}