Fix auto updater attempting to update to "null"
This commit is contained in:
+29
-5
@@ -25,6 +25,11 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
@Mixin(Minecraft.class)
|
||||
public class MixinMinecraft
|
||||
{
|
||||
@Unique
|
||||
private static final Logger LOGGER = DhLoggerBuilder.getLogger(MixinMinecraft.class.getSimpleName());
|
||||
|
||||
|
||||
|
||||
#if MC_VER < MC_1_20_2
|
||||
#if MC_VER == MC_1_20_1
|
||||
@Redirect(
|
||||
@@ -68,6 +73,7 @@ public class MixinMinecraft
|
||||
)
|
||||
private void buildInitialScreens(Runnable runnable)
|
||||
{
|
||||
// TODO merge logic for forge, neo, and fabric
|
||||
if (
|
||||
Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get() // Don't do anything if the user doesn't want it
|
||||
&& SelfUpdater.onStart()
|
||||
@@ -86,11 +92,29 @@ public class MixinMinecraft
|
||||
versionId = GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha");
|
||||
}
|
||||
|
||||
Minecraft.getInstance().setScreen(new UpdateModScreen(
|
||||
// TODO: Change to runnable, instead of tittle screen
|
||||
new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons
|
||||
versionId
|
||||
));
|
||||
if (versionId != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
Minecraft.getInstance().setScreen(new UpdateModScreen(
|
||||
// TODO: Change to runnable, instead of tittle screen
|
||||
new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons
|
||||
versionId
|
||||
));
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
// info instead of error since this can be ignored and probably just means
|
||||
// there isn't a new DH version available
|
||||
LOGGER.info("Unable to show DH update screen, reason: ["+e.getMessage()+"].");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.info("Unable to find new DH update for the ["+updateBranch+"] branch. Assuming DH is up to date...");
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user