Render engine validation cleanup and 26.2.0 prep

This commit is contained in:
James Seibel
2026-06-03 07:45:31 -05:00
parent 19df5c10cb
commit 0dfbcb3c6d
9 changed files with 22 additions and 14 deletions
@@ -6,6 +6,7 @@ import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiBeforeD
import com.seibel.distanthorizons.common.commands.CommandInitializer; import com.seibel.distanthorizons.common.commands.CommandInitializer;
import com.seibel.distanthorizons.common.wrappers.DependencySetup; import com.seibel.distanthorizons.common.wrappers.DependencySetup;
import com.seibel.distanthorizons.common.wrappers.gui.DhDebugScreenEntry; import com.seibel.distanthorizons.common.wrappers.gui.DhDebugScreenEntry;
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftClientWrapper;
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftServerWrapper; import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftServerWrapper;
import com.seibel.distanthorizons.core.Initializer; import com.seibel.distanthorizons.core.Initializer;
import com.seibel.distanthorizons.core.api.internal.ClientApi; import com.seibel.distanthorizons.core.api.internal.ClientApi;
@@ -262,6 +263,8 @@ public abstract class AbstractModInitializer
} }
catch (Exception e) catch (Exception e)
{ {
NativeDialogUtil.showDialog(ModInfo.READABLE_NAME, e.getMessage(), "ok", "error");
MinecraftClientWrapper.INSTANCE.crashMinecraft(e.getMessage(), e);
future.completeExceptionally(e); future.completeExceptionally(e);
} }
finally finally
@@ -50,8 +50,10 @@ public class MixinImmersivePortalsRenderStatesCommon
// camera pos // camera pos
#if MC_VER <= MC_1_21_10 #if MC_VER <= MC_1_21_10
Vec3 cameraPos = mc.gameRenderer.getMainCamera().getPosition(); Vec3 cameraPos = mc.gameRenderer.getMainCamera().getPosition();
#else #elif MC_VER <= MC_26_1_2
Vec3 cameraPos = mc.gameRenderer.getMainCamera().position(); Vec3 cameraPos = mc.gameRenderer.getMainCamera().position();
#else
Vec3 cameraPos = mc.gameRenderer.mainCamera().position();
#endif #endif
AbstractImmersivePortalsAccessorCommon.actualCameraPos = new DhVec3d(cameraPos.x(), cameraPos.y(), cameraPos.z()); AbstractImmersivePortalsAccessorCommon.actualCameraPos = new DhVec3d(cameraPos.x(), cameraPos.y(), cameraPos.z());
} }
@@ -6,7 +6,6 @@ public class BlazeDhRenderApiDefinition {}
#else #else
import com.seibel.distanthorizons.api.enums.config.EDhApiRenderingApi; import com.seibel.distanthorizons.api.enums.config.EDhApiRenderingApi;
import com.seibel.distanthorizons.api.enums.config.EDhApiRenderingEngine;
import com.seibel.distanthorizons.common.render.blaze.objects.BlazeGenericObjectVertexContainer; import com.seibel.distanthorizons.common.render.blaze.objects.BlazeGenericObjectVertexContainer;
import com.seibel.distanthorizons.common.render.blaze.postProcessing.BlazeDhFarFadeRenderer; import com.seibel.distanthorizons.common.render.blaze.postProcessing.BlazeDhFarFadeRenderer;
import com.seibel.distanthorizons.common.render.blaze.postProcessing.BlazeDhFogRenderer; import com.seibel.distanthorizons.common.render.blaze.postProcessing.BlazeDhFogRenderer;
@@ -35,8 +34,8 @@ public class BlazeDhRenderApiDefinition extends AbstractDhRenderApiDefinition
//=========// //=========//
//region //region
private final String apiName; private final String engineName;
public String getApiName() { return this.apiName; } public String getEngineName() { return this.engineName; }
public EDhRenderDepth getRenderDepth() public EDhRenderDepth getRenderDepth()
{ {
@@ -66,11 +65,11 @@ public class BlazeDhRenderApiDefinition extends AbstractDhRenderApiDefinition
#if MC_VER <= MC_26_1_2 #if MC_VER <= MC_26_1_2
renderApi = EDhApiRenderingApi.OPEN_GL; renderApi = EDhApiRenderingApi.OPEN_GL;
#else #else
// use the same rendering API as Minecraft // Blaze always uses the same rendering API as Minecraft
this.renderApi = MinecraftRenderWrapper.INSTANCE.getMcRenderingApi(); this.renderApi = MinecraftRenderWrapper.INSTANCE.getMcRenderingApi();
#endif #endif
this.apiName = "Blaze3D: " + this.getRenderApi(); this.engineName = "Blaze3D: " + this.getRenderApi();
} }
//endregion //endregion
@@ -16,6 +16,7 @@ import com.seibel.distanthorizons.common.render.blaze.wrappers.uniform.BlazeUnif
import com.seibel.distanthorizons.core.logging.DhLogger; import com.seibel.distanthorizons.core.logging.DhLogger;
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
import java.util.Optional;
import java.util.OptionalDouble; import java.util.OptionalDouble;
import java.util.OptionalInt; import java.util.OptionalInt;
import java.util.function.Supplier; import java.util.function.Supplier;
@@ -26,7 +26,7 @@ public class GlDhRenderApiDefinition extends AbstractDhRenderApiDefinition
//=========// //=========//
//region //region
public String getApiName() { return "OpenGL"; } public String getEngineName() { return "OpenGL"; }
public EDhRenderDepth getRenderDepth() public EDhRenderDepth getRenderDepth()
{ {
@@ -134,7 +134,7 @@ public class DependencySetup
// crash if an invalid API is set // crash if an invalid API is set
if (!validApi) if (!validApi)
{ {
String message = "["+renderingApiEnum+"] is not supported on this version of Minecraft, reverting to ["+ EDhApiRenderingEngine.AUTO+"]."; String message = "The Distant Horizons rendering engine ["+renderDefinition.getEngineName()+"]-["+renderingApiEnum+"] is not supported with this Minecraft config, reverting to ["+ EDhApiRenderingEngine.AUTO+"].";
LOGGER.fatal(message); LOGGER.fatal(message);
Config.Client.Advanced.Graphics.Experimental.renderingEngine.set(EDhApiRenderingEngine.AUTO); Config.Client.Advanced.Graphics.Experimental.renderingEngine.set(EDhApiRenderingEngine.AUTO);
throw new IllegalStateException(message); throw new IllegalStateException(message);
@@ -144,14 +144,14 @@ public class DependencySetup
EDhApiRenderingApi mcRenderApi = MinecraftRenderWrapper.INSTANCE.getMcRenderingApi(); EDhApiRenderingApi mcRenderApi = MinecraftRenderWrapper.INSTANCE.getMcRenderingApi();
if (mcRenderApi != renderDefinition.getRenderApi()) if (mcRenderApi != renderDefinition.getRenderApi())
{ {
String message = "["+renderDefinition.getApiName()+"] cannot be used due to it's API ["+renderDefinition.getRenderApi().name()+"] not matching what Minecraft is currently set to use. Please either change Minecraft's rendering API or Distant Horizons'."; String message = "The Distant Horizons rendering engine ["+renderDefinition.getEngineName()+"]-["+renderDefinition.getRenderApi().name()+"] cannot be used since it's API doesn't match what Minecraft is currently set to use ["+mcRenderApi.name()+"]. Please either change Minecraft's rendering API or Distant Horizons'.";
LOGGER.fatal(message); LOGGER.fatal(message);
throw new IllegalStateException(message); throw new IllegalStateException(message);
} }
renderDefinition.bindRenderers(); renderDefinition.bindRenderers();
LOGGER.info("DH Rendering successfully bound to: ["+renderDefinition.getApiName()+"]..."); LOGGER.info("DH Rendering successfully bound to: ["+renderDefinition.getEngineName()+"]...");
} }
@@ -400,9 +400,12 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
float frameTime = this.getPartialTickTime(); float frameTime = this.getPartialTickTime();
int argbColorInt = MC.level.getSkyColor(MC.gameRenderer.getMainCamera().getPosition(), frameTime); int argbColorInt = MC.level.getSkyColor(MC.gameRenderer.getMainCamera().getPosition(), frameTime);
return ColorUtil.toColorObjARGB(argbColorInt); return ColorUtil.toColorObjARGB(argbColorInt);
#else #elif MC_VER <= MC_26_1_2
int argbColor = MC.level.environmentAttributes().getValue(EnvironmentAttributes.SKY_COLOR, MC.gameRenderer.getMainCamera().position()); int argbColor = MC.level.environmentAttributes().getValue(EnvironmentAttributes.SKY_COLOR, MC.gameRenderer.getMainCamera().position());
return new Color(ColorUtil.getRed(argbColor), ColorUtil.getGreen(argbColor), ColorUtil.getBlue(argbColor), 255 /* ignore alpha since DH clouds don't render correctly with transparency */); return new Color(ColorUtil.getRed(argbColor), ColorUtil.getGreen(argbColor), ColorUtil.getBlue(argbColor), 255 /* ignore alpha since DH clouds don't render correctly with transparency */);
#else
int argbColor = MC.level.environmentAttributes().getValue(EnvironmentAttributes.SKY_COLOR, MC.gameRenderer.mainCamera().position());
return new Color(ColorUtil.getRed(argbColor), ColorUtil.getGreen(argbColor), ColorUtil.getBlue(argbColor), 255 /* ignore alpha since DH clouds don't render correctly with transparency */);
#endif #endif
} }
else else
+2 -2
View File
@@ -1,8 +1,8 @@
# 26.2.0 version # 26.2.0 version
java_version=25 java_version=25
minecraft_version=26.2-snapshot-7 minecraft_version=26.2-pre-3
parchment_version=1.21:2024.07.28 parchment_version=1.21:2024.07.28
compatible_minecraft_versions=["26.2.0","26.2-alpha.7"] compatible_minecraft_versions=["26.2.0","26.2-pre.3"]
accessWidenerVersion=26_1 accessWidenerVersion=26_1
builds_for=fabric builds_for=fabric
#,neoforge #,neoforge