From 4fa3be23a3f90403506780c1e94eb7c8beb1f01f Mon Sep 17 00:00:00 2001 From: "Josiah (Gaming32) Glosson" Date: Sun, 21 Jan 2024 12:57:22 -0600 Subject: [PATCH] Fix #58 --- .../github/gaming32/worldhost/mixin/MixinMinecraft.java | 8 +++++++- version.gradle.kts | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/gaming32/worldhost/mixin/MixinMinecraft.java b/src/main/java/io/github/gaming32/worldhost/mixin/MixinMinecraft.java index 3cd0aab..b2da272 100644 --- a/src/main/java/io/github/gaming32/worldhost/mixin/MixinMinecraft.java +++ b/src/main/java/io/github/gaming32/worldhost/mixin/MixinMinecraft.java @@ -6,6 +6,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.ConnectScreen; import net.minecraft.client.gui.screens.Overlay; +import net.minecraft.client.gui.screens.ProgressScreen; import net.minecraft.client.gui.screens.Screen; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -74,7 +75,12 @@ private void tickEvent(CallbackInfo ci) { @Inject(method = "setScreen", at = @At("HEAD")) private void clearCurrentlyConnecting(Screen guiScreen, CallbackInfo ci) { - if (!(guiScreen instanceof ConnectScreen) && !(guiScreen instanceof JoiningWorldHostScreen) && WorldHost.protoClient != null) { + if ( + !(guiScreen instanceof ConnectScreen) && + !(guiScreen instanceof JoiningWorldHostScreen) && + !(guiScreen instanceof ProgressScreen) && + WorldHost.protoClient != null + ) { WorldHost.protoClient.setAttemptingToJoin(null); } } diff --git a/version.gradle.kts b/version.gradle.kts index 3075116..ab9d98e 100644 --- a/version.gradle.kts +++ b/version.gradle.kts @@ -37,7 +37,7 @@ base.archivesName.set(rootProject.name) // to MMmmPP val mcVersion by extra(mcVersionString.split(".").map { it.toInt() } .let { - it[0] * 1_00_00 + it[1] * 1_00 + (if (it.size == 2 || it[2] == 0) 0 else it[2]) + it[0] * 1_00_00 + it[1] * 1_00 + it.getOrElse(2) { 0 } }) println("MC_VERSION: $mcVersionString $mcVersion")