diff --git a/src/main/java/io/github/gaming32/worldhost/WorldHost.java b/src/main/java/io/github/gaming32/worldhost/WorldHost.java index a365b95..aa90769 100644 --- a/src/main/java/io/github/gaming32/worldhost/WorldHost.java +++ b/src/main/java/io/github/gaming32/worldhost/WorldHost.java @@ -644,7 +644,6 @@ public static String getExternalIp() { return null; } if (proxyProtocolClient != null) { - LOGGER.info("Using external proxy for external IP"); return getExternalIp0(proxyProtocolClient.getBaseAddr(), proxyProtocolClient.getMcPort()); } if (protoClient.getBaseIp().isEmpty()) { diff --git a/src/main/java/io/github/gaming32/worldhost/mixin/MixinShareToLanScreen.java b/src/main/java/io/github/gaming32/worldhost/mixin/MixinShareToLanScreen.java index 57caa87..265c345 100644 --- a/src/main/java/io/github/gaming32/worldhost/mixin/MixinShareToLanScreen.java +++ b/src/main/java/io/github/gaming32/worldhost/mixin/MixinShareToLanScreen.java @@ -9,8 +9,7 @@ //#if MC < 1.19.4 //$$ import io.github.gaming32.worldhost.versions.Components; //$$ import org.spongepowered.asm.mixin.injection.At; -//$$ import org.spongepowered.asm.mixin.injection.ModifyArgs; -//$$ import org.spongepowered.asm.mixin.injection.invoke.arg.Args; +//$$ import org.spongepowered.asm.mixin.injection.ModifyArg; //#endif @Mixin(ShareToLanScreen.class) @@ -26,13 +25,38 @@ private String changeLabelI2(String constant) { } //#if MC < 1.19.4 - //$$ @ModifyArgs( + //$$ @ModifyArg( + //$$ method = + //#if MC < 1.17.1 + //$$ {"lambda$init$0*", "func_213082_d"}, // Mixin can't find lambda$init$0 for some reason, so have an obfuscated method name :) + //#else + //$$ "lambda$init$2", + //#endif + //$$ at = @At( + //$$ value = "INVOKE", + //$$ target = + //#if MC >= 1.19.2 + //$$ "Lnet/minecraft/network/chat/Component;translatable(Ljava/lang/String;[Ljava/lang/Object;)Lnet/minecraft/network/chat/MutableComponent;" + //#else + //$$ "Lnet/minecraft/network/chat/TranslatableComponent;(Ljava/lang/String;[Ljava/lang/Object;)V" + //#endif + //$$ ) + //$$ ) + //$$ private String changeSuccessMessage(String key) { + //$$ if (WorldHost.CONFIG.isEnableFriends()) { + //$$ return "world-host.lan_opened.friends"; + //$$ } + //$$ final String externalIp = WorldHost.getExternalIp(); + //$$ return externalIp != null ? "world-host.lan_opened.no_friends" : key; + //$$ } + //$$ + //$$ @ModifyArg( //$$ method = //#if MC < 1.17.1 //#if FABRIC //$$ "lambda$init$0", //#else - //$$ "func_213082_d", // Mixin can't find lambda$init$0 for some reason, so have an obfuscated method name :) + //$$ {"lambda$init$0*", "func_213082_d"}, // Mixin can't find lambda$init$0 for some reason, so have an obfuscated method name :) //#endif //#else //$$ "lambda$init$2", @@ -40,34 +64,28 @@ private String changeLabelI2(String constant) { //$$ at = @At( //$$ value = "INVOKE", //$$ target = - //#if MC >= 1.19.2 - //$$ "Lnet/minecraft/network/chat/Component;translatable(Ljava/lang/String;[Ljava/lang/Object;)Lnet/minecraft/network/chat/MutableComponent;" - //#else - //$$ "Lnet/minecraft/network/chat/TranslatableComponent;(Ljava/lang/String;[Ljava/lang/Object;)V" - //#endif + //#if MC >= 1.19.2 + //$$ "Lnet/minecraft/network/chat/Component;translatable(Ljava/lang/String;[Ljava/lang/Object;)Lnet/minecraft/network/chat/MutableComponent;" + //#else + //$$ "Lnet/minecraft/network/chat/TranslatableComponent;(Ljava/lang/String;[Ljava/lang/Object;)V" + //#endif //$$ ) //$$ ) - //$$ private void changeSuccessMessage(Args args) { - //$$ final Object[] tArgs = args.get(1); - //$$ final Object port = tArgs[0]; + //$$ private Object[] changeSuccessMessage(Object[] args) { + //$$ final Object port = args[0]; //$$ if (WorldHost.CONFIG.isEnableFriends()) { - //$$ args.setAll( - //$$ "world-host.lan_opened.friends", - //$$ new Object[] { - //$$ Components.copyOnClickText(port) - //$$ } - //$$ ); - //$$ return; + //$$ return new Object[] { + //$$ Components.copyOnClickText(port) + //$$ }; //$$ } //$$ final String externalIp = WorldHost.getExternalIp(); - //$$ if (externalIp == null) return; - //$$ args.setAll( - //$$ "world-host.lan_opened.no_friends", - //$$ new Object[] { - //$$ Components.copyOnClickText(externalIp), - //$$ Components.copyOnClickText(port) - //$$ } - //$$ ); + //$$ if (externalIp == null) { + //$$ return args; + //$$ } + //$$ return new Object[] { + //$$ Components.copyOnClickText(externalIp), + //$$ Components.copyOnClickText(port) + //$$ }; //$$ } //#endif } diff --git a/version.gradle.kts b/version.gradle.kts index 4581fee..86fa235 100644 --- a/version.gradle.kts +++ b/version.gradle.kts @@ -222,8 +222,8 @@ dependencies { if (isFabric) { when (mcVersion) { - 1_20_04 -> "9.0.0-pre.1" // TODO: Update out of pre - 1_20_02 -> "8.0.0" + 1_20_04 -> "9.0.0" + 1_20_02 -> "8.0.1" 1_20_01 -> "7.2.2" 1_19_04 -> "6.3.1" 1_19_02 -> "4.2.0-beta.2" @@ -239,10 +239,12 @@ dependencies { } } - // TODO: Remove this if when DevAuth gets Neo support on Maven - if (!isNeoForge) { - modRuntimeOnly("me.djtheredstoner:DevAuth-${if (isFabric) "fabric" else "forge-latest"}:1.1.2") - } + when { + isFabric -> "fabric" + isForge -> "forge-latest" + isNeoForge -> "neoforge" + else -> null + }?.let { modRuntimeOnly("me.djtheredstoner:DevAuth-$it:1.2.0") } if (isFabric) { when (mcVersion) { @@ -253,7 +255,8 @@ dependencies { 1_19_02 -> "0.77.0+1.19.2" 1_18_02 -> "0.77.0+1.18.2" 1_17_01 -> "0.46.1+1.17" - 1_16_05, 1_16_01 -> "0.42.0+1.16" + 1_16_05 -> "0.42.0+1.16" + 1_16_01 -> "0.18.0+build.387-1.16.1" else -> null }?.let { fabricApi.fabricModule("fabric-resource-loader-v0", it) } ?.let {