diff --git a/src/main/java/com/gtnewhorizons/angelica/config/AngelicaConfig.java b/src/main/java/com/gtnewhorizons/angelica/config/AngelicaConfig.java index 0ac822930..0c7801237 100644 --- a/src/main/java/com/gtnewhorizons/angelica/config/AngelicaConfig.java +++ b/src/main/java/com/gtnewhorizons/angelica/config/AngelicaConfig.java @@ -239,4 +239,15 @@ public class AngelicaConfig { @Config.DefaultBoolean(true) public static boolean replaceFFPUploads; + @Config.Comment("Pinned OpenGL version an integer (e.g. 46, 41, 33). 0 = auto-detect. [33, 46]. (Disable with disableGLVersionPinning=true)") + @Config.DefaultInt(0) + @Config.RangeInt(min = 0, max = 46) + @Config.RequiresMcRestart + public static int pinnedGLVersion; + + @Config.Comment("Disable automatic GL version pinning. When true, always probes from highest on every launch.") + @Config.DefaultBoolean(false) + @Config.RequiresMcRestart + public static boolean disableGLVersionPinning; + } diff --git a/src/main/java/com/gtnewhorizons/angelica/glsm/GLStateManager.java b/src/main/java/com/gtnewhorizons/angelica/glsm/GLStateManager.java index 34ebee2d4..476e8ff81 100644 --- a/src/main/java/com/gtnewhorizons/angelica/glsm/GLStateManager.java +++ b/src/main/java/com/gtnewhorizons/angelica/glsm/GLStateManager.java @@ -1537,6 +1537,7 @@ public class GLStateManager { } } alphaTest.enable(); + fragmentGeneration++; } public static void disableAlphaTest() { @@ -1554,6 +1555,7 @@ public class GLStateManager { } } alphaTest.disable(); + fragmentGeneration++; } public static void glAlphaFunc(int function, float reference) { diff --git a/src/main/java/com/gtnewhorizons/angelica/loading/fml/tweakers/AngelicaLateTweaker.java b/src/main/java/com/gtnewhorizons/angelica/loading/fml/tweakers/AngelicaLateTweaker.java index 542fb6567..9e4cf253b 100644 --- a/src/main/java/com/gtnewhorizons/angelica/loading/fml/tweakers/AngelicaLateTweaker.java +++ b/src/main/java/com/gtnewhorizons/angelica/loading/fml/tweakers/AngelicaLateTweaker.java @@ -6,7 +6,9 @@ import net.minecraft.launchwrapper.Launch; import net.minecraft.launchwrapper.LaunchClassLoader; import java.io.File; +import java.lang.reflect.Field; import java.util.List; +import java.util.Set; public class AngelicaLateTweaker implements ITweaker { @@ -17,7 +19,41 @@ public class AngelicaLateTweaker implements ITweaker { @Override public void injectIntoClassLoader(LaunchClassLoader classLoader) { - // no-op + narrowTransformerExclusions(classLoader); + } + + /** + * Reduces overly broad transformer exclusions that prevent AngelicaRedirector from doing its job. + * + * Looking at you, DragonAPI. + */ + @SuppressWarnings("unchecked") + private static void narrowTransformerExclusions(LaunchClassLoader classLoader) { + try { + final Field exceptionsField = LaunchClassLoader.class.getDeclaredField("transformerExceptions"); + exceptionsField.setAccessible(true); + final Set exceptions = (Set) exceptionsField.get(classLoader); + + if (exceptions.remove("Reika.DragonAPI.ASM")) { + // Don't read ASMCallsClient and Patchers/Fixes/WorldRenderAlpha. The rest are fair game. + + // Re-add the other non utility classes + exceptions.add("Reika.DragonAPI.ASM.Patchers"); + exceptions.add("Reika.DragonAPI.ASM.Profiling"); + exceptions.add("Reika.DragonAPI.ASM.APIStripper"); + exceptions.add("Reika.DragonAPI.ASM.ClassReparenter"); + exceptions.add("Reika.DragonAPI.ASM.DependentMethodStripper"); + exceptions.add("Reika.DragonAPI.ASM.DragonAPIClassTransformer"); + exceptions.add("Reika.DragonAPI.ASM.FMLItemBlockPatch"); + exceptions.add("Reika.DragonAPI.ASM.FluidNamePatch"); + exceptions.add("Reika.DragonAPI.ASM.InterfaceInjector"); + exceptions.add("Reika.DragonAPI.ASM.SpecialBiomePlacement"); + exceptions.add("Reika.DragonAPI.ASM.StructureLootHooks"); + FMLRelaunchLog.info("[Angelica] Narrowed Reika.DragonAPI.ASM transformer exclusion to allow GL redirection of utility classes"); + } + } catch (Exception e) { + FMLRelaunchLog.warning("[Angelica] Failed to narrow transformer exclusions: %s", e.getMessage()); + } } @Override diff --git a/src/main/java/me/flashyreese/mods/reeses_sodium_options/client/gui/ReeseSodiumVideoOptionsScreen.java b/src/main/java/me/flashyreese/mods/reeses_sodium_options/client/gui/ReeseSodiumVideoOptionsScreen.java index 2d6276bb0..23dea6158 100644 --- a/src/main/java/me/flashyreese/mods/reeses_sodium_options/client/gui/ReeseSodiumVideoOptionsScreen.java +++ b/src/main/java/me/flashyreese/mods/reeses_sodium_options/client/gui/ReeseSodiumVideoOptionsScreen.java @@ -283,7 +283,7 @@ public class ReeseSodiumVideoOptionsScreen extends SodiumOptionsGUI { } if (keyCode == Keyboard.KEY_P) { if(isShiftKeyDown()){ - this.mc.displayGuiScreen(new GuiCustomMenu(this.prevScreen, SodiumGameOptionPages.general(), SodiumGameOptionPages.quality(), SodiumGameOptionPages.advanced(), SodiumGameOptionPages.performance(), SodiumGameOptionPages.appearance(), SodiumGameOptionPages.debug())); + this.mc.displayGuiScreen(new GuiCustomMenu(this.prevScreen, SodiumGameOptionPages.general(), SodiumGameOptionPages.quality(), SodiumGameOptionPages.advanced(), SodiumGameOptionPages.performance(), SodiumGameOptionPages.appearance())); } else if (isCtrlKeyDown()) { this.mc.displayGuiScreen(new SodiumOptionsGUI(this.prevScreen)); } diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumGameOptionPages.java b/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumGameOptionPages.java index 4077e325c..3040305cb 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumGameOptionPages.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumGameOptionPages.java @@ -540,20 +540,4 @@ public class SodiumGameOptionPages { return new OptionPage(I18n.format("sodium.options.pages.appearance"), ImmutableList.copyOf(groups)); } - public static OptionPage debug() { - final List groups = new ArrayList<>(); - - groups.add(OptionGroup.createBuilder() - .add(OptionImpl.createBuilder(boolean.class, sodiumOpts) - .setName(I18n.format("sodium.options.use_gl_state_cache.name")) - .setTooltip(I18n.format("sodium.options.use_gl_state_cache.tooltip")) - .setControl(TickBoxControl::new) - .setImpact(OptionImpact.EXTREME) - .setBinding((opts, value) -> GLStateManager.BYPASS_CACHE = !value, opts -> !GLStateManager.BYPASS_CACHE) - .setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD) - .build()) - .build()); - - return new OptionPage(I18n.format("sodium.options.pages.debug"), ImmutableList.copyOf(groups)); - } } diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumOptionsGUI.java b/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumOptionsGUI.java index 563b16f81..0ead038d3 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumOptionsGUI.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumOptionsGUI.java @@ -77,7 +77,6 @@ public class SodiumOptionsGUI extends ScrollableGuiScreen { this.pages.add(shaderPacks); } - this.pages.add(SodiumGameOptionPages.debug()); } public void setPage(OptionPage page) { @@ -302,7 +301,7 @@ public class SodiumOptionsGUI extends ScrollableGuiScreen { if (keyCode == Keyboard.KEY_P && isShiftKeyDown()) { this.mc.displayGuiScreen(new GuiCustomMenu(this.prevScreen, SodiumGameOptionPages.general(), SodiumGameOptionPages.quality(), SodiumGameOptionPages.advanced(), SodiumGameOptionPages.performance(), - SodiumGameOptionPages.appearance(), SodiumGameOptionPages.debug())); + SodiumGameOptionPages.appearance())); } } diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gui/utils/URLUtils.java b/src/main/java/me/jellysquid/mods/sodium/client/gui/utils/URLUtils.java deleted file mode 100644 index fb9f5362a..000000000 --- a/src/main/java/me/jellysquid/mods/sodium/client/gui/utils/URLUtils.java +++ /dev/null @@ -1,27 +0,0 @@ -package me.jellysquid.mods.sodium.client.gui.utils; - -import com.gtnewhorizons.angelica.AngelicaMod; -import net.minecraft.util.Util; - -import java.io.IOException; - -public class URLUtils { - - private static String[] getURLOpenCommand(String url) { - return switch (Util.getOSType()) { - case WINDOWS -> new String[]{"rundll32", "url.dll,FileProtocolHandler", url}; - case OSX -> new String[]{"open", url}; - case UNKNOWN, LINUX, SOLARIS -> new String[]{"xdg-open", url}; - }; - } - - public static void open(String url) { - try { - Runtime.getRuntime().exec(getURLOpenCommand(url)); - } catch (IOException exception) { - AngelicaMod.LOGGER.error("Couldn't open url '{}'", url, exception); - } - - } - -} diff --git a/src/main/resources/assets/angelica/lang/de_DE.lang b/src/main/resources/assets/angelica/lang/de_DE.lang index 8773020f8..5df71a5a8 100644 --- a/src/main/resources/assets/angelica/lang/de_DE.lang +++ b/src/main/resources/assets/angelica/lang/de_DE.lang @@ -83,8 +83,6 @@ sodium.options.always_defer_chunk_updates.name=Chunk Updates immer herauszögern sodium.options.always_defer_chunk_updates.tooltip=Wenn angeschaltet, wartet das Rendering nie, bis Chunkupdates vollzogen wurden, selbst wenn sie wichtig sind. Das kann in manchen Szenarios die Bildrate stark verbessern, aber signfikanten Grafiklag in der Welt erzeugen. sodium.options.use_no_error_context.name=Kein Fehlerkontext sodium.options.use_no_error_context.tooltip=Aktiviert den OpenGL-Kontext ohne Fehlerüberprüfung. Das kann die Performance leicht verbessern, erhöht aber auch das Crashrisiko bei OpenGL-Fehlern. Schalt es aus, wenn du unerwartete Crashes erlebst. -sodium.options.use_gl_state_cache.name=GL-Zustandscache -sodium.options.use_gl_state_cache.tooltip=Wenn angeschaltet, wird der OpenGL-Zustandscache verwendet um die Anzahl an redundanten Operationen zu senken. Das kann die Performance erhöhen, aber auch Probleme mit einigen Mods auslösen. Diese Option bleibt nicht über Spielstarts hinweg erhalten. sodium.options.threads.value=%s Thread(s) sodium.options.default=Standard sodium.options.buttons.undo=Rückgängig diff --git a/src/main/resources/assets/angelica/lang/en_US.lang b/src/main/resources/assets/angelica/lang/en_US.lang index 70fe244ac..8512ba798 100644 --- a/src/main/resources/assets/angelica/lang/en_US.lang +++ b/src/main/resources/assets/angelica/lang/en_US.lang @@ -14,7 +14,6 @@ sodium.options.pages.quality=Quality sodium.options.pages.performance=Performance sodium.options.pages.advanced=Advanced sodium.options.pages.appearance=Appearance -sodium.options.pages.debug=Debug sodium.options.view_distance.tooltip=The render distance controls how far away terrain will be rendered. Shorter distances mean that less terrain will be rendered, improving frame rates. sodium.options.simulation_distance.tooltip=The simulation distance controls how far away terrain and entities will be loaded and ticked. Shorter distances can reduce the internal server's load and may improve frame rates. sodium.options.brightness.tooltip=Controls the brightness (gamma) of the game. @@ -86,8 +85,6 @@ sodium.options.always_defer_chunk_updates.name=Always Defer Chunk Updates sodium.options.always_defer_chunk_updates.tooltip=If enabled, rendering will never wait for chunk updates to finish, even if they are important. This can greatly improve frame rates in some scenarios, but it may create significant visual lag in the world. sodium.options.use_no_error_context.name=No Error Context sodium.options.use_no_error_context.tooltip=If enabled, the OpenGL context will be created with error checking disabled. This may slightly improve performance, but it also increases the risk that the game will crash instead of gracefully handling OpenGL errors. You should disable this option if you are experiencing sudden unexplained crashes. -sodium.options.use_gl_state_cache.name=GL State Cache -sodium.options.use_gl_state_cache.tooltip=If enabled, the OpenGL state cache will be used to reduce the number of redundant state changes. This can improve performance, but it may also cause issues with some mods. Does not persist across game restarts. sodium.options.async_occlusion_mode.name=Async Occlusion sodium.options.async_occlusion_mode.tooltip=Controls which render passes use asynchronous occlusion culling. ONLY_SHADOW (default) runs async occlusion only for the shadow pass, keeping the main render list synchronous. EVERYTHING runs all passes async, which may cause 1-frame visibility lag during fast camera movement. NONE disables async occlusion entirely. sodium.options.use_occlusion_culling.name=Occlusion Culling diff --git a/src/main/resources/assets/angelica/lang/pl_PL.lang b/src/main/resources/assets/angelica/lang/pl_PL.lang index ab140d506..01a60902a 100644 --- a/src/main/resources/assets/angelica/lang/pl_PL.lang +++ b/src/main/resources/assets/angelica/lang/pl_PL.lang @@ -79,8 +79,6 @@ sodium.options.always_defer_chunk_updates.name=Zawsze opóźniaj aktualizacje ch sodium.options.always_defer_chunk_updates.tooltip=Jeśli włączone, renderowanie nigdy nie będzie czekać aż aktualizacje chunków się zakończą, nawet gdy są one ważne. To może znacznie poprawić wydajność klatek w niektórych przypadkach, ale może skutkować widocznym opóźnieniem na świecie. sodium.options.use_no_error_context.name=Brak kontekstu błędu sodium.options.use_no_error_context.tooltip=Jeśli włączone, kontekst OpenGL zostanie stworzony z wyłączonym sprawdzaniem błędów. To może minimalnie zwiększyć wydajność, ale również zwiększa ryzyko awarii gry zamiast radzenia sobie z błędami OpenGL. Powinieneś wyłączyć tą opcję, jeśli napotykasz nagłe i niewyjaśnione awarie. -sodium.options.use_gl_state_cache.name=Pamięć podręczna stanu GL -sodium.options.use_gl_state_cache.tooltip=Jeśli włączone, pamięć podręczna stanu OpenGL będzie użyta aby zmniejszyć ilość niepotrzebnych zmian stanu. To może zwiększyć wydajność, ale może też spowodować problemy z modami. Nie utrzymuje się po ponownym uruchomieniu gry. sodium.options.threads.value=%s wątek(ów) sodium.options.default=Domyślne sodium.options.buttons.undo=Cofnij diff --git a/src/main/resources/assets/angelica/lang/ru_RU.lang b/src/main/resources/assets/angelica/lang/ru_RU.lang index 1ac0322e9..3e5836c7a 100644 --- a/src/main/resources/assets/angelica/lang/ru_RU.lang +++ b/src/main/resources/assets/angelica/lang/ru_RU.lang @@ -81,8 +81,6 @@ sodium.options.always_defer_chunk_updates.name=Всегда Откладыват sodium.options.always_defer_chunk_updates.tooltip=Если включено, отрисовка никогда не будет ждать завершения обновлений чанков, даже если они важны. Это может значительно улучшить частоту кадров в некоторых сценариях, но это может создать значительную визуальную задержку в мире. sodium.options.use_no_error_context.name=Без Контекста Ошибок sodium.options.use_no_error_context.tooltip=Если включено, контекст OpenGL будет создан с отключенной проверкой ошибок. Это может немного улучшить производительность, но также увеличивает риск того, что игра будет вылетать, а не грациозно обрабатывать ошибки OpenGL. Вы должны отключить эту опцию, если у вас возникают внезапные необъяснимые сбои. -sodium.options.use_gl_state_cache.name=Кэш Состояния GL -sodium.options.use_gl_state_cache.tooltip=Если включено, будет использоваться кэш состояния OpenGL, чтобы уменьшить количество избыточных изменений состояния. Это может улучшить производительность, но также может вызвать проблемы с некоторыми модами. Не сохраняется при перезапуске игры. sodium.options.threads.value=%s поток(ов) sodium.options.default=По умолчанию sodium.options.buttons.undo=Отменить diff --git a/src/main/resources/assets/angelica/lang/zh_CN.lang b/src/main/resources/assets/angelica/lang/zh_CN.lang index 531a3906f..30b0371f5 100644 --- a/src/main/resources/assets/angelica/lang/zh_CN.lang +++ b/src/main/resources/assets/angelica/lang/zh_CN.lang @@ -84,8 +84,6 @@ sodium.options.always_defer_chunk_updates.tooltip=如果启用,渲染将永远 sodium.options.use_no_error_context.name=使用禁用错误检查的上下文 sodium.options.use_no_error_context.tooltip=如果启用,OpenGL日志将不包含详细错误信息。这可能略微提高性能,但也可能因为无法精确处理OpenGL错误而导致游戏崩溃。如遇到不明原因的突然崩溃,则应禁用此选项。 sodium.options.threads.value=%s 线程 -sodium.options.use_gl_state_cache.name=启用GL状态缓存 -sodium.options.use_gl_state_cache.tooltip=如果启用,OpenGL状态缓存将减少冗余状态更改的次数。这可以提高性能,但也可能导致一些模组出现问题。每次重启游戏时此项将重置。 sodium.options.default=默认 sodium.options.buttons.undo=撤销 sodium.options.buttons.apply=应用 diff --git a/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/angelica/MixinForgeHooksClient_CoreProfile.java b/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/angelica/MixinForgeHooksClient_CoreProfile.java index ab7ccda4a..0eda8e8d2 100644 --- a/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/angelica/MixinForgeHooksClient_CoreProfile.java +++ b/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/angelica/MixinForgeHooksClient_CoreProfile.java @@ -1,6 +1,10 @@ package com.gtnewhorizons.angelica.mixins.early.angelica; +import com.gtnewhorizon.gtnhlib.config.ConfigurationManager; +import com.gtnewhorizons.angelica.config.AngelicaConfig; import net.minecraftforge.client.ForgeHooksClient; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.lwjgl.LWJGLException; import org.lwjgl.opengl.ContextAttribs; import org.lwjgl.opengl.Display; @@ -18,11 +22,13 @@ import java.lang.invoke.MethodHandles; import java.lang.reflect.Field; /** - * Requests highest GL version with core profile context + * Requests highest GL version with core profile context, with optional version pinning. */ @Mixin(value = ForgeHooksClient.class, remap = false) public abstract class MixinForgeHooksClient_CoreProfile { + @Unique private static final Logger LOGGER = LogManager.getLogger("Angelica"); + @Shadow static int stencilBits; /** @@ -38,7 +44,7 @@ public abstract class MixinForgeHooksClient_CoreProfile { final PixelFormat format = new PixelFormat().withDepthBits(24).withStencilBits(stencilBits); - final ContextAttribs attribs = new ContextAttribs(4, 5).withProfileCore(true).withForwardCompatible(true); + final ContextAttribs attribs = new ContextAttribs(3, 3).withProfileCore(true).withForwardCompatible(true); final MethodHandle setMajor, setMinor; try { final Field majorField = ContextAttribs.class.getDeclaredField("majorVersion"); @@ -52,42 +58,91 @@ public abstract class MixinForgeHooksClient_CoreProfile { throw new RuntimeException("Failed to obtain ContextAttribs version setters", e); } - final int startMajor = 4; - final int startMaxMinor = (LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_MACOSX) ? 1 : 6; + final int platformMaxMajor = 4; + final int platformMaxMinor = (LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_MACOSX) ? 1 : 6; + final int platformMax = platformMaxMajor * 10 + platformMaxMinor; - Exception cur_exception = null; - for (int major = startMajor; major >= 3; --major) { - final int maxMinor = (major == 4) ? startMaxMinor : 3; + // Try pinned version first if configured + final int pinned = angelica$clampPinned(AngelicaConfig.pinnedGLVersion, platformMax); + if (pinned >= 33) { + final Exception e = angelica$tryCreate(attribs, format, setMajor, setMinor, pinned / 10, pinned % 10); + if (e == null) { + LOGGER.info("Created GL {}.{} core profile context (pinned)", pinned / 10, pinned % 10); + return; + } + LOGGER.warn("Pinned GL version {}.{} failed, probing from highest", pinned / 10, pinned % 10); + } + + // Probe from highest to lowest + Exception lastException = null; + for (int major = platformMaxMajor; major >= 3; --major) { + final int maxMinor = (major == 4) ? platformMaxMinor : 3; final int minMinor = (major == 3) ? 3 : 0; for (int minor = maxMinor; minor >= minMinor; --minor) { - try { - setMajor.invokeExact(attribs, major); - setMinor.invokeExact(attribs, minor); - } catch (Throwable t) { - throw new RuntimeException("Failed to set ContextAttribs version", t); - } - try { - Display.create(format, attribs); + final Exception e = angelica$tryCreate(attribs, format, setMajor, setMinor, major, minor); + if (e == null) { + final int version = major * 10 + minor; + LOGGER.info("Created GL {}.{} core profile context", major, minor); + // Auto-pin if below platform max, or update a stale pin + if (version < platformMax && AngelicaConfig.pinnedGLVersion != version && (AngelicaConfig.pinnedGLVersion != 0 || !AngelicaConfig.disableGLVersionPinning)) { + angelica$savePin(version); + } return; - } catch (LWJGLException | RuntimeException e) { - try { Display.destroy(); } catch (Exception ignored) {} - cur_exception = e; } + lastException = e; } } - angelica$reportContextFailure(cur_exception); - if (cur_exception instanceof LWJGLException lwjgl) { + + angelica$reportContextFailure(lastException); + if (lastException instanceof LWJGLException lwjgl) { throw lwjgl; } - throw new LWJGLException("Failed to create OpenGL core profile context", cur_exception); + throw new LWJGLException("Failed to create OpenGL core profile context", lastException); + } + + @Unique + private static int angelica$clampPinned(int pinned, int platformMax) { + if (pinned == 0) return 0; + if (pinned >= 33 && pinned <= platformMax) return pinned; + final int clamped = Math.max(33, Math.min(pinned, platformMax)); + LOGGER.warn("pinnedGLVersion={} is out of range (33-{}), clamping to {}", pinned, platformMax, clamped); + return clamped; + } + + @Unique + private static Exception angelica$tryCreate(ContextAttribs attribs, PixelFormat format, MethodHandle setMajor, MethodHandle setMinor, int major, int minor) throws RuntimeException { + try { + setMajor.invokeExact(attribs, major); + setMinor.invokeExact(attribs, minor); + } catch (Throwable t) { + throw new RuntimeException("Failed to set ContextAttribs version", t); + } + try { + Display.create(format, attribs); + return null; + } catch (LWJGLException | RuntimeException e) { + try { Display.destroy(); } catch (Exception ignored) {} + return e; + } + } + + @Unique + private static void angelica$savePin(int version) { + AngelicaConfig.pinnedGLVersion = version; + try { + ConfigurationManager.save(AngelicaConfig.class); + LOGGER.info("Pinned OpenGL version to {}.{} — set pinnedGLVersion=0 to re-probe, or disableGLVersionPinning=true to never pin", version / 10, version % 10); + } catch (Exception e) { + LOGGER.warn("Failed to save pinned GL version: {}", e.getMessage()); + } } @Unique private static void angelica$reportContextFailure(Exception e) { - System.err.println("[Angelica] FATAL: Failed to create OpenGL core profile context."); - System.err.println("[Angelica] Error: " + e.getMessage()); + LOGGER.error("FATAL: Failed to create OpenGL core profile context."); + LOGGER.error("Error: {}", e != null ? e.getMessage() : "unknown"); try { - System.err.println("[Angelica] GPU: " + GL11.glGetString(GL11.GL_RENDERER) + ", Driver: " + GL11.glGetString(GL11.GL_VERSION)); + LOGGER.error("GPU: {}, Driver: {}", GL11.glGetString(GL11.GL_RENDERER), GL11.glGetString(GL11.GL_VERSION)); } catch (Exception ignored) {} } } diff --git a/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/shaders/MixinTileEntityRendererDispatcher.java b/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/shaders/MixinTileEntityRendererDispatcher.java index 1d0fbcbf9..6a99a4ad7 100644 --- a/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/shaders/MixinTileEntityRendererDispatcher.java +++ b/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/shaders/MixinTileEntityRendererDispatcher.java @@ -17,6 +17,10 @@ public class MixinTileEntityRendererDispatcher { @Inject(method = "renderTileEntityAt(Lnet/minecraft/tileentity/TileEntity;DDDF)V", at = @At("HEAD")) private void iris$setBlockEntityId(TileEntity te, double x, double y, double z, float partialTicks, CallbackInfo ci) { + if (te == null) { + CapturedRenderingState.INSTANCE.setCurrentBlockEntity(0); + return; + } Block block = te.getBlockType(); if (block == null) { CapturedRenderingState.INSTANCE.setCurrentBlockEntity(0);