diff --git a/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/modAccessor/AbstractOptifineAccessor.java b/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/modAccessor/AbstractOptifineAccessor.java index e65002706..29683a624 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/modAccessor/AbstractOptifineAccessor.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/modAccessor/AbstractOptifineAccessor.java @@ -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; + } + } + }