Skip to content

Instantly share code, notes, and snippets.

@WhyNotHugo
Created June 17, 2014 22:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WhyNotHugo/25a6e1a86129be9e0270 to your computer and use it in GitHub Desktop.
Save WhyNotHugo/25a6e1a86129be9e0270 to your computer and use it in GitHub Desktop.
Run minecraft forcing IPv6 on
import java.io.IOException;
import java.net.InetAddress;
import net.minecraft.bootstrap.Bootstrap;
/*
* Launches minecraft forcing the usage of IPv6.
* You should make sure minecraft.jar is added to the classpath
* That's /usr/share/minecraft/minecraft.jar on most distros.
*
* This wrapper requires no future changes unless Mojang changes
* the class containing main() in future.
*/
public class MinecraftIPv6 {
public static void main(String[] args) throws IOException {
// This is an IPv6 launcher, force IPv6, no matter what.
System.setProperty("java.net.preferIPv6Addresses", "true");
// Unnecesary?:
// System.setProperty("java.net.preferIPv4Stack", "false");
// InetAddress reads on it's first usage. If it's not used here,
// Bootstrap will override it before using InetAddress, reverting the
// above.
InetAddress.getByName(null);
// Call the actual game Bootstrap
Bootstrap.main(args);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment