I'll tell you right away, I am new guy. Please tell me how to disconnect from the server, make autoreconnect. (several times, so that the user could log in after restarting the server). I apologize for my English.
I sketched a little, non-working)
package com.example.examplemod;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.FMLNetworkEvent;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ServerData;
@Mod(modid = Reconnect.MODID, version = Reconnect.VERSION)
public class Reconnect
{
public static final String MODID = "Reconnect";
public static final String VERSION = "1.0";
@SubscribeEvent
public void onClientDisconnect(FMLNetworkEvent.ClientDisconnectionFromServerEvent event)
{
FMLClientHandler.instance().connectToServer(null, new ServerData("Сервер Minecraft", "159.69.136.213:4015"));
}
}