2013-04-13 16:33:37 +02:00
|
|
|
package mekanism.client;
|
|
|
|
|
2013-10-14 20:08:15 +02:00
|
|
|
import java.net.InetAddress;
|
|
|
|
|
|
|
|
import mekanism.client.voice.VoiceClient;
|
2013-04-13 16:33:37 +02:00
|
|
|
import mekanism.common.Mekanism;
|
|
|
|
import net.minecraft.network.INetworkManager;
|
|
|
|
import net.minecraft.network.NetLoginHandler;
|
|
|
|
import net.minecraft.network.packet.NetHandler;
|
|
|
|
import net.minecraft.network.packet.Packet1Login;
|
|
|
|
import net.minecraft.server.MinecraftServer;
|
|
|
|
import cpw.mods.fml.common.network.IConnectionHandler;
|
|
|
|
import cpw.mods.fml.common.network.Player;
|
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public class ClientConnectionHandler implements IConnectionHandler
|
|
|
|
{
|
|
|
|
@Override
|
2013-10-14 20:25:04 +02:00
|
|
|
public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager) {}
|
2013-04-13 16:33:37 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public String connectionReceived(NetLoginHandler netHandler, INetworkManager manager)
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2013-12-03 03:37:11 +01:00
|
|
|
/* Remote */
|
2013-04-13 16:33:37 +02:00
|
|
|
@Override
|
|
|
|
public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager)
|
|
|
|
{
|
2013-10-28 12:16:22 +01:00
|
|
|
if(Mekanism.voiceServerEnabled)
|
|
|
|
{
|
|
|
|
try {
|
2013-12-22 22:49:04 +01:00
|
|
|
MekanismClient.voiceClient = new VoiceClient(server);
|
2013-10-28 12:16:22 +01:00
|
|
|
} catch(Exception e) {}
|
|
|
|
}
|
2013-04-13 16:33:37 +02:00
|
|
|
}
|
|
|
|
|
2013-12-03 03:37:11 +01:00
|
|
|
/* Integrated */
|
2013-04-13 16:33:37 +02:00
|
|
|
@Override
|
|
|
|
public void connectionOpened(NetHandler netClientHandler, MinecraftServer server, INetworkManager manager)
|
|
|
|
{
|
2013-10-28 12:16:22 +01:00
|
|
|
if(Mekanism.voiceServerEnabled)
|
|
|
|
{
|
|
|
|
try {
|
2013-12-22 22:49:04 +01:00
|
|
|
MekanismClient.voiceClient = new VoiceClient(InetAddress.getLocalHost().getHostAddress());
|
2013-10-28 12:16:22 +01:00
|
|
|
} catch(Exception e) {}
|
|
|
|
}
|
2013-04-13 16:33:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-12-09 23:54:59 +01:00
|
|
|
public void connectionClosed(INetworkManager manager) {}
|
2013-04-13 16:33:37 +02:00
|
|
|
|
|
|
|
@Override
|
2013-10-14 20:08:15 +02:00
|
|
|
public void clientLoggedIn(NetHandler clientHandler, INetworkManager manager, Packet1Login login) {}
|
2013-04-13 16:33:37 +02:00
|
|
|
}
|