Fix incompatibility with "Fast IP Ping"
Inject in a different place to prevent the mixin from failing to apply. It looks like we do essentially the same logic anyways.
This commit is contained in:
@@ -10,7 +10,7 @@ loader_version=0.16.14
|
||||
supported_minecraft_versions=1.21.6
|
||||
neoforge_version=21.6.11-beta
|
||||
neoform_version=1.21.6-20250617.151856
|
||||
fabric_api_version=0.127.0+1.21.6
|
||||
fabric_api_version=0.127.1+1.21.6
|
||||
snakeyaml_version=2.3
|
||||
concurrentutil_version=0.0.3
|
||||
yamlconfig_version=1.0.2
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package ca.spottedleaf.moonrise.mixin.serverlist;
|
||||
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import net.minecraft.client.multiplayer.resolver.ServerAddress;
|
||||
import net.minecraft.client.multiplayer.resolver.ServerAddressResolver;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
@Mixin(ServerAddressResolver.class)
|
||||
@@ -20,19 +23,18 @@ interface ServerAddressResolverMixin {
|
||||
"lambda$static$0"
|
||||
},
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Ljava/net/InetAddress;getByName(Ljava/lang/String;)Ljava/net/InetAddress;"
|
||||
value = "NEW",
|
||||
target = "(Ljava/net/InetAddress;I)Ljava/net/InetSocketAddress;"
|
||||
)
|
||||
)
|
||||
private static InetAddress eliminateRDNS(final String name) throws UnknownHostException {
|
||||
final InetAddress ret = InetAddress.getByName(name);
|
||||
|
||||
final byte[] address = ret.getAddress();
|
||||
private static InetSocketAddress eliminateRDNS(InetAddress addr, final int port,
|
||||
@Local(ordinal = 0, argsOnly = true) final ServerAddress serverAddress) throws UnknownHostException {
|
||||
final byte[] address = addr.getAddress();
|
||||
if (address != null) {
|
||||
// pass name to prevent rDNS
|
||||
return InetAddress.getByAddress(name, address);
|
||||
addr = InetAddress.getByAddress(serverAddress.getHost(), address);
|
||||
}
|
||||
|
||||
return ret;
|
||||
return new InetSocketAddress(addr, port);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user