Fix bukkit connectivity issue.
This commit is contained in:
parent
f125c0ddd3
commit
ef1ee38b55
|
@ -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()
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue