From 55155103ec1b622045e3fa576d7abf7ced2ec86c Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 15 Mar 2026 16:24:03 -0500 Subject: [PATCH] revert to AUTO rendering A if an invalid API is selected --- .../common/wrappers/DependencySetup.java | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/DependencySetup.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/DependencySetup.java index 95c3deca9..b0d03841a 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/DependencySetup.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/DependencySetup.java @@ -91,23 +91,43 @@ public class DependencySetup LOGGER.info("Setting DH Rendering API to: ["+renderingApiEnum+"]."); + + + boolean validApi; AbstractDhRenderApiDefinition renderDefinition; if (renderingApiEnum == EDhApiRenderApi.OPEN_GL) { + validApi = true; renderDefinition = new GlDhRenderApiDefinition(); } else if (renderingApiEnum == EDhApiRenderApi.BLAZE_3D) { #if MC_VER <= MC_1_21_10 - throw new IllegalStateException("["+renderingApiEnum+"] is not supported on this version of Minecraft."); + validApi = false; + renderDefinition = null; #else + validApi = true; renderDefinition = new BlazeDhRenderApiDefinition(); #endif } else { - throw new IllegalStateException("No ["+ AbstractDhRenderApiDefinition.class.getSimpleName()+"] concrete implementation found for the value: ["+renderingApiEnum+"]."); + String message = "No ["+ AbstractDhRenderApiDefinition.class.getSimpleName()+"] concrete implementation found for the value: ["+renderingApiEnum+"]."; + LOGGER.fatal(message); + throw new IllegalStateException(message); } + + + // crash if an invalid API is set + if (!validApi) + { + String message = "["+renderingApiEnum+"] is not supported on this version of Minecraft, reverting to ["+EDhApiRenderApi.AUTO+"]."; + LOGGER.fatal(message); + Config.Client.Advanced.Graphics.Experimental.renderingApi.set(EDhApiRenderApi.AUTO); + throw new IllegalStateException(message); + } + + renderDefinition.bindRenderers(); }