omgwtfbbq Builder
Posts : 62 Reputation : 0 Join date : 2011-10-27 Location : The Heartland of MIcrosoft
| Subject: Can't play MC multiplayer under forced proxy :( Sun Dec 04, 2011 9:04 pm | |
| I posted this on mincraft modding sites, if anyone here could help me that would be great b/c if i could get this working i would be on a lot more lol heres the post: - Quote :
Hello,
I've been looking around for a while on how to get minecraft multiplayer to work through a proxy. The environment i get internet through most often has an HTTP proxy set up that requires programs wanting to access the internet to be configured to go through the forced proxy. I've tried multiple solutions, including changing the java network settings in the control panel, port tunneling, and trying to run minecraft with arguments that would require it to go through the specific proxy through a batch file. (I realize there are some third party programs that do this but I can't use those). I resorted to modifying the code, specifically GuiMultiplayer.jar, which i tracked the polling and packet sending down to.
The contents of the file are below (and stuff I changed highlighted)
- Code:
-
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) braces deadcode fieldsfirst
package net.minecraft.src;
import java.io.*; import java.net.InetSocketAddress; import java.net.Socket; import java.util.ArrayList; import java.util.List; import net.minecraft.client.Minecraft; import org.lwjgl.input.Keyboard;
import java.net.Proxy; //ADDED
//SKIPPING METHODS THAT HAVEN'T BEEN CHANGED
private void pollServer(ServerNBTStorage servernbtstorage) throws IOException { String s = servernbtstorage.host; String as[] = s.split(":"); if(s.startsWith("[")) { int i = s.indexOf("]"); if(i > 0) { String s2 = s.substring(1, i); String s3 = s.substring(i + 1).trim(); if(s3.startsWith(":") && s3.length() > 0) { s3 = s3.substring(1); as = new String[2]; as[0] = s2; as[1] = s3; } else { as = new String[1]; as[0] = s2; } } } if(as.length > 2) { as = new String[1]; as[0] = s; } String s1 = as[0]; int j = as.length <= 1 ? 25565 : parseIntWithDefault(as[1], 25565);
//ADDITIONS CHANGES START HERE
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("web-proxy", 8080));
//ADDITIONS END HERE
Socket socket = null; DataInputStream datainputstream = null; DataOutputStream dataoutputstream = null; try {
//CHANGES START HERE
socket = new Socket(proxy); //CHANGE FROM : socket = new Socket();
//CHANGES END HERE
socket.setSoTimeout(3000); socket.setTcpNoDelay(true); socket.setTrafficClass(18); socket.connect(new InetSocketAddress(s1, j), 3000); datainputstream = new DataInputStream(socket.getInputStream()); dataoutputstream = new DataOutputStream(socket.getOutputStream()); dataoutputstream.write(254); if(datainputstream.read() != 255) { throw new IOException("Bad message"); } String s4 = Packet.readString(datainputstream, 64); char ac[] = s4.toCharArray(); for(int k = 0; k < ac.length; k++) { if(ac[k] != '\247' && ChatAllowedCharacters.allowedCharacters.indexOf(ac[k]) < 0) { ac[k] = '?'; } }
s4 = new String(ac); String as1[] = s4.split("\247"); s4 = as1[0]; int l = -1; int i1 = -1; try { l = Integer.parseInt(as1[1]); i1 = Integer.parseInt(as1[2]); } catch(Exception exception) { } servernbtstorage.motd = (new StringBuilder()).append("\2477").append(s4).toString(); if(l >= 0 && i1 > 0) { servernbtstorage.playerCount = (new StringBuilder()).append("\2477").append(l).append("\2478/\2477").append
(i1).toString(); } else { servernbtstorage.playerCount = "\2478???"; } } finally { try { if(datainputstream != null) { datainputstream.close(); } } catch(Throwable throwable) { } try { if(dataoutputstream != null) { dataoutputstream.close(); } } catch(Throwable throwable1) { } try { if(socket != null) { socket.close(); } } catch(Throwable throwable2) { } } }
After going through some changes to get it to recompile, i ended up with this dissatisfying result:
Any ideas on how to fix this?
Thanks so much for your help in advance
| |
|