Skip to content

Commit

Permalink
Fix various issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaming32 committed Mar 25, 2024
1 parent b7d7433 commit dc3ab9e
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 35 deletions.
1 change: 0 additions & 1 deletion src/main/java/io/github/gaming32/worldhost/WorldHost.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -26,48 +25,67 @@ 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;<init>(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",
//#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;<init>(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;<init>(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
}
17 changes: 10 additions & 7 deletions version.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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) {
Expand All @@ -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 {
Expand Down

0 comments on commit dc3ab9e

Please sign in to comment.