From ca550a0a57c9c6ddb80daa99dd1ea602119ff1a8 Mon Sep 17 00:00:00 2001 From: Acuadragon100 <8165958-acuadragon100@users.noreply.gitlab.com> Date: Thu, 23 Apr 2026 12:07:31 +0200 Subject: [PATCH] Disable fade rendering when immersive portals and sodium are active at once. --- .../common/ImmersivePortalsCompat.java | 95 ------------------- coreSubProjects | 2 +- .../distanthorizons/fabric/FabricMain.java | 1 + .../mixins/client/MixinLevelRenderer.java | 4 +- .../distanthorizons/forge/ForgeMain.java | 5 +- .../neoforge/NeoforgeClientProxy.java | 6 +- 6 files changed, 10 insertions(+), 103 deletions(-) delete mode 100644 common/src/main/java/com/seibel/distanthorizons/common/ImmersivePortalsCompat.java diff --git a/common/src/main/java/com/seibel/distanthorizons/common/ImmersivePortalsCompat.java b/common/src/main/java/com/seibel/distanthorizons/common/ImmersivePortalsCompat.java deleted file mode 100644 index 62b54c132..000000000 --- a/common/src/main/java/com/seibel/distanthorizons/common/ImmersivePortalsCompat.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * This file is part of the Distant Horizons mod - * licensed under the GNU LGPL v3 License. - * - * Copyright (C) 2020 James Seibel - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.seibel.distanthorizons.common; - -import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; -import com.seibel.distanthorizons.core.logging.DhLogger; - -/** - * Runtime detection and compatibility handling for Immersive Portals - */ -public class ImmersivePortalsCompat -{ - private static final DhLogger LOGGER = new DhLoggerBuilder().build(); - - private static volatile Boolean isImmersivePortalsPresent = null; - private static volatile Boolean isImmersivePortalsActive = null; - - /** - * Check if Immersive Portals is present in the mod environment - */ - public static boolean isImmersivePortalsPresent() - { - if (isImmersivePortalsPresent == null) - { - synchronized (ImmersivePortalsCompat.class) - { - if (isImmersivePortalsPresent == null) - { - try - { - // Try to load an Immersive Portals class - Class.forName("qouteall.imm_ptl.core.IPMcHelper"); - isImmersivePortalsPresent = true; - LOGGER.info("Immersive Portals detected - enabling compatibility features"); - } - catch (ClassNotFoundException e) - { - isImmersivePortalsPresent = false; - LOGGER.debug("Immersive Portals not detected - using standard level management"); - } - } - } - } - return isImmersivePortalsPresent; - } - - /** - * Check if Immersive Portals compatibility should be active - * This checks both presence and configuration - */ - public static boolean isImmersivePortalsActive() - { - if (isImmersivePortalsActive == null) - { - synchronized (ImmersivePortalsCompat.class) - { - if (isImmersivePortalsActive == null) - { - // TODO: Add configuration check here - isImmersivePortalsActive = isImmersivePortalsPresent(); - } - } - } - return isImmersivePortalsActive; - } - - /** - * Reset detection cache (useful for testing) - */ - public static void resetDetection() - { - synchronized (ImmersivePortalsCompat.class) - { - isImmersivePortalsPresent = null; - isImmersivePortalsActive = null; - } - } -} diff --git a/coreSubProjects b/coreSubProjects index 7b0c66e3a..3d13ba764 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 7b0c66e3aef9c980c486be8c5de945923a889406 +Subproject commit 3d13ba7645e4e28e41b7b0f3c4ca9918ef6737c5 diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java index 00b995a6c..6020877fd 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricMain.java @@ -116,6 +116,7 @@ public class FabricMain extends AbstractModInitializer implements ClientModIniti this.tryCreateModCompatAccessor("optifine", IOptifineAccessor.class, OptifineAccessor::new); this.tryCreateModCompatAccessor("bclib", IBCLibAccessor.class, BCLibAccessor::new); this.tryCreateModCompatAccessor("c2me", IC2meAccessor.class, C2meAccessor::new); + this.tryCreateModCompatAccessor("imm_ptl_core", IImmersivePortalsAccessor.class, ImmersivePortalsAccessor::new); #if MC_VER >= MC_1_19_4 // 1.19.4 is the lowest version Iris supports DH this.tryCreateModCompatAccessor("iris", IIrisAccessor.class, IrisAccessor::new); diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java index 26d1c0830..0b8a15c28 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/mixins/client/MixinLevelRenderer.java @@ -75,8 +75,10 @@ import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapp import com.seibel.distanthorizons.common.wrappers.McObjectConverter; import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper; import com.seibel.distanthorizons.core.api.internal.ClientApi; +import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector; import com.seibel.distanthorizons.coreapi.ModInfo; import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; +import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IImmersivePortalsAccessor; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.renderer.LevelRenderer; @@ -176,7 +178,7 @@ public class MixinLevelRenderer ClientLevelWrapper wrapper = (ClientLevelWrapper) ClientApi.RENDER_STATE.clientLevelWrapper; // Apply Immersive Portals compatibility only when IP is detected - if (com.seibel.distanthorizons.common.ImmersivePortalsCompat.isImmersivePortalsActive()) + if (ModAccessorInjector.INSTANCE.get(IImmersivePortalsAccessor.class) != null) { if (!wrapper.isDhLevelLoaded()) { diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java index 6a1d9171a..301eb9e56 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeMain.java @@ -24,10 +24,8 @@ import com.seibel.distanthorizons.common.AbstractModInitializer; import com.seibel.distanthorizons.common.wrappers.gui.GetConfigScreen; import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; import com.seibel.distanthorizons.core.wrapperInterfaces.misc.IPluginPacketSender; -import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IIrisAccessor; -import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModChecker; +import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.*; import com.seibel.distanthorizons.coreapi.ModInfo; -import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IOptifineAccessor; import com.seibel.distanthorizons.forge.wrappers.modAccessor.ModChecker; import com.seibel.distanthorizons.forge.wrappers.modAccessor.OptifineAccessor; @@ -104,6 +102,7 @@ public class ForgeMain extends AbstractModInitializer { this.tryCreateModCompatAccessor("optifine", IOptifineAccessor.class, OptifineAccessor::new); this.tryCreateModCompatAccessor("oculus", IIrisAccessor.class, OculusAccessor::new); + this.tryCreateModCompatAccessor("imm_ptl_core", IImmersivePortalsAccessor.class, ImmersivePortalsAccessor::new); #if MC_VER < MC_1_17_1 ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.CONFIGGUIFACTORY, diff --git a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeClientProxy.java b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeClientProxy.java index 81ceb9f6f..e0598fa8c 100644 --- a/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeClientProxy.java +++ b/neoforge/src/main/java/com/seibel/distanthorizons/neoforge/NeoforgeClientProxy.java @@ -244,7 +244,7 @@ public class NeoforgeClientProxy implements AbstractModInitializer.IEventProxy if (ClientApi.RENDER_STATE.clientLevelWrapper instanceof ClientLevelWrapper) { ClientLevelWrapper wrapper = (ClientLevelWrapper) ClientApi.RENDER_STATE.clientLevelWrapper; - if (ImmersivePortalsCompat.isImmersivePortalsActive()) + if (ModAccessorInjector.INSTANCE.get(IImmersivePortalsAccessor.class) != null) { if (!wrapper.isDhLevelLoaded()) { @@ -274,7 +274,7 @@ public class NeoforgeClientProxy implements AbstractModInitializer.IEventProxy if (ClientApi.RENDER_STATE.clientLevelWrapper instanceof ClientLevelWrapper) { ClientLevelWrapper wrapper = (ClientLevelWrapper) ClientApi.RENDER_STATE.clientLevelWrapper; - if (ImmersivePortalsCompat.isImmersivePortalsActive()) + if (ModAccessorInjector.INSTANCE.get(IImmersivePortalsAccessor.class) != null) { if (!wrapper.isDhLevelLoaded()) { @@ -301,7 +301,7 @@ public class NeoforgeClientProxy implements AbstractModInitializer.IEventProxy if (ClientApi.RENDER_STATE.clientLevelWrapper instanceof ClientLevelWrapper) { ClientLevelWrapper wrapper = (ClientLevelWrapper) ClientApi.RENDER_STATE.clientLevelWrapper; - if (ImmersivePortalsCompat.isImmersivePortalsActive()) + if (ModAccessorInjector.INSTANCE.get(IImmersivePortalsAccessor.class) != null) { if (!wrapper.isDhLevelLoaded()) {