Fix bukkit connectivity issue.

This commit is contained in:
Christian committed 2014-01-16 14:58:28 -05:00
1 parent a4686b1261
commit dd17979a2f
6 files changed
+55

No files matched your search

@@ -32,6 +32,7 @@ import net.minecraft.client.gui.ServerListEntryNormal;
import net.minecraft.client.multiplayer.GuiConnecting;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.client.network.OldServerPinger;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
@@ -684,5 +685,28 @@ public class FMLClientHandler implements IFMLSidedHandler
{
showGuiScreen(new GuiConnecting(guiMultiplayer, client, serverEntry));
}
playClientBlock = new CountDownLatch(1);
}
private CountDownLatch playClientBlock;
public void setPlayClient(NetHandlerPlayClient netHandlerPlayClient)
{
playClientBlock.countDown();
}
@Override
public void waitForPlayClient()
{
boolean gotIt = false;
try
{
gotIt = playClientBlock.await(1,TimeUnit.SECONDS);
} catch (InterruptedException e)
{
}
if (!gotIt)
{
throw new RuntimeException("Timeout waiting for client thread to catch up!");
}
}
}
@@ -498,4 +498,9 @@ public class FMLCommonHandler
{
return sidedDelegate.getClientPlayHandler();
}
public void waitForPlayClient()
{
sidedDelegate.waitForPlayClient();
}
}
@@ -48,4 +48,6 @@ public interface IFMLSidedHandler
NetworkManager getClientToServerNetworkManager();
INetHandler getClientPlayHandler();
void waitForPlayClient();
}
@@ -148,6 +148,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet> imple
void clientListenForServerHandshake()
{
manager.func_150723_a(EnumConnectionState.PLAY);
FMLCommonHandler.instance().waitForPlayClient();
this.netHandler = FMLCommonHandler.instance().getClientPlayHandler();
this.state = ConnectionState.AWAITING_HANDSHAKE;
}
@@ -221,4 +221,9 @@ public class FMLServerHandler implements IFMLSidedHandler
{
return null;
}
@Override
public void waitForPlayClient()
{
// NOOP
}
}