From a496eab56e8cffe1dad84e8533e2444d740875eb Mon Sep 17 00:00:00 2001 From: Meldexun <27779321+Meldexun@users.noreply.github.com> Date: Fri, 29 Mar 2024 14:36:49 +0100 Subject: [PATCH] Fix incompatibility with RenderLib 1.3.3+ --- .../valkyrie/mixin/MinecraftMixin.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/dev/redstudio/valkyrie/mixin/MinecraftMixin.java b/src/main/java/dev/redstudio/valkyrie/mixin/MinecraftMixin.java index 143d2ec..8b75f49 100644 --- a/src/main/java/dev/redstudio/valkyrie/mixin/MinecraftMixin.java +++ b/src/main/java/dev/redstudio/valkyrie/mixin/MinecraftMixin.java @@ -43,18 +43,18 @@ private void printCustomF3Shortcuts(final int auxKey, final CallbackInfoReturnab * @reason Remove the version from the window title and add configurability. * @author Desoroxxx */ - @Overwrite - private void createDisplay() throws LWJGLException { - Display.setResizable(true); - Display.setTitle(ValkyrieConfig.general.windowTitle + (FMLLaunchHandler.isDeobfuscatedEnvironment() ? " Development Environment" : "")); - - try { - Display.create((new PixelFormat()).withDepthBits(ValkyrieConfig.general.highPrecisionDepthBuffer ? 32 : 24)); - } catch (LWJGLException lwjglexception) { - RED_LOGGER.printFramedError("Minecraft Initialization", "Could not set pixel format", "Things relying on depth buffer precision may not work properly", lwjglexception.getMessage()); + @ModifyConstant(method = "createDisplay", constant = @Constant(stringValue = "Minecraft 1.12.2")) + private String modifyWindowTitle(String title) { + return ValkyrieConfig.general.windowTitle + (FMLLaunchHandler.isDeobfuscatedEnvironment() ? " Development Environment" : ""); + } - Display.create(); - } + /** + * @reason Use 32 bit depth buffer if enabled in config. + * @author Desoroxxx + */ + @ModifyConstant(method = "createDisplay", constant = @Constant(intValue = 24)) + private int modifyDepthBits(int bits) { + return ValkyrieConfig.general.highPrecisionDepthBuffer ? 32 : 24; } /**