Fix bukkit connectivity issue.

This commit is contained in:
Christian 2014-01-16 14:58:28 -05:00
parent f125c0ddd3
commit ef1ee38b55
6 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,18 @@
--- ../src-base/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java
+++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java
@@ -1,6 +1,7 @@
package net.minecraft.client.network;
import com.google.common.base.Charsets;
+import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
@@ -215,6 +216,7 @@
this.field_147299_f = p_i45061_1_;
this.field_147307_j = p_i45061_2_;
this.field_147302_e = p_i45061_3_;
+ FMLClientHandler.instance().setPlayClient(this);
}
public void func_147296_c()

View File

@ -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!");
}
}
}

View File

@ -498,4 +498,9 @@ public class FMLCommonHandler
{
return sidedDelegate.getClientPlayHandler();
}
public void waitForPlayClient()
{
sidedDelegate.waitForPlayClient();
}
}

View File

@ -48,4 +48,6 @@ public interface IFMLSidedHandler
NetworkManager getClientToServerNetworkManager();
INetHandler getClientPlayHandler();
void waitForPlayClient();
}

View File

@ -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;
}

View File

@ -221,4 +221,9 @@ public class FMLServerHandler implements IFMLSidedHandler
{
return null;
}
@Override
public void waitForPlayClient()
{
// NOOP
}
}