Skip to content

Commit a0e55d5

Browse files
committed
fix crash with iris 1.7.3 when enabling VR in the main menu when a shader was active
1 parent 01f02e9 commit a0e55d5

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

common/src/main/java/org/vivecraft/mod_compat_vr/iris/IrisHelper.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public class IrisHelper {
4141
private static Method CapturedRenderingState_getGbufferProjection;
4242

4343
private static Method WorldRenderingSettings_setUseExtendedVertexFormat;
44+
private static Method WorldRenderingSettings_shouldUseExtendedVertexFormat;
4445

4546
public static boolean isIrisLoaded() {
4647
return Xplat.isModLoaded("iris") || Xplat.isModLoaded("oculus");
@@ -83,7 +84,11 @@ public static boolean hasWaterEffect() {
8384
}
8485

8586
public static boolean isShaderActive() {
86-
return IrisApi.getInstance().isShaderPackInUse();
87+
try {
88+
return IrisApi.getInstance().isShaderPackInUse() || (WorldRenderingSettings_shouldUseExtendedVertexFormat != null && (boolean) WorldRenderingSettings_shouldUseExtendedVertexFormat.invoke(WorldRenderingSettings.INSTANCE));
89+
} catch (InvocationTargetException | IllegalAccessException e) {
90+
return false;
91+
}
8792
}
8893

8994
public static boolean hasIssuesWithMenuWorld() {
@@ -164,6 +169,7 @@ private static boolean init() {
164169

165170
try {
166171
WorldRenderingSettings_setUseExtendedVertexFormat = Class.forName("net.irisshaders.iris.shaderpack.materialmap.WorldRenderingSettings").getMethod("setUseExtendedVertexFormat", boolean.class);
172+
WorldRenderingSettings_shouldUseExtendedVertexFormat = Class.forName("net.irisshaders.iris.shaderpack.materialmap.WorldRenderingSettings").getMethod("shouldUseExtendedVertexFormat");
167173
} catch (ClassNotFoundException | NoSuchMethodException ignore) {}
168174

169175
// distant horizon compat

0 commit comments

Comments
 (0)