Fix auto update screen not appearing on MC 26.1.2

May also be necessary for old MC versions
This commit is contained in:
James Seibel
2026-05-15 22:13:46 -05:00
parent 965b9c948e
commit 7861b63c99
@@ -9,6 +9,7 @@ import com.seibel.distanthorizons.core.jar.installer.ModrinthGetter;
import com.seibel.distanthorizons.core.jar.updater.SelfUpdater; import com.seibel.distanthorizons.core.jar.updater.SelfUpdater;
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 com.seibel.distanthorizons.core.render.RenderThreadTaskHandler;
import com.seibel.distanthorizons.core.wrapperInterfaces.IVersionConstants; import com.seibel.distanthorizons.core.wrapperInterfaces.IVersionConstants;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
#if MC_VER <= MC_1_12_2 #if MC_VER <= MC_1_12_2
@@ -73,26 +74,31 @@ public class DhUpdateScreenBase
} }
try // running on the render thread is required since setting the MC screen may trigger
// before its allowed, silently failing
RenderThreadTaskHandler.INSTANCE.queueRunningOnRenderThread("Update Screen", () ->
{ {
#if MC_VER <= MC_1_12_2 try
MC.displayGuiScreen(new UpdateModScreen( {
new GuiMainMenu(), #if MC_VER <= MC_1_12_2
versionId MC.displayGuiScreen(new UpdateModScreen(
)); new GuiMainMenu(),
#else versionId
MC.setScreen(new UpdateModScreen( ));
new TitleScreen(false), #else
versionId MC.setScreen(new UpdateModScreen(
)); new TitleScreen(false),
#endif versionId
} ));
catch (Exception e) #endif
{ }
// info instead of error since this can be ignored and probably just means catch (Exception e)
// there isn't a new DH version available {
LOGGER.info("Unable to show DH update screen, reason: ["+e.getMessage()+"]."); // info instead of error since this can be ignored and probably just means
} // there isn't a new DH version available
LOGGER.error("Unable to show DH update screen, reason: ["+e.getMessage()+"].");
}
});
}; };
runnable.run(); runnable.run();
} }