mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Finish forge hand shaking before enabling the chat prompt.
This commit is contained in:
parent
fb87de1ff5
commit
3a19de82ae
1 changed files with 46 additions and 0 deletions
|
|
@ -772,6 +772,15 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
{
|
{
|
||||||
ConsoleIO.WriteLineFormatted("§8Server is in offline mode.");
|
ConsoleIO.WriteLineFormatted("§8Server is in offline mode.");
|
||||||
login_phase = false;
|
login_phase = false;
|
||||||
|
|
||||||
|
if (forgeInfo != null) {
|
||||||
|
// Do the forge handshake.
|
||||||
|
if (!CompleteForgeHandshake())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
StartUpdating();
|
StartUpdating();
|
||||||
return true; //No need to check session or start encryption
|
return true; //No need to check session or start encryption
|
||||||
}
|
}
|
||||||
|
|
@ -779,6 +788,33 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Completes the Minecraft Forge handshake.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Whether the handshake was successful.</returns>
|
||||||
|
private bool CompleteForgeHandshake()
|
||||||
|
{
|
||||||
|
int packetID = -1;
|
||||||
|
byte[] packetData = new byte[0];
|
||||||
|
|
||||||
|
while (fmlHandshakeState != FMLHandshakeClientState.DONE)
|
||||||
|
{
|
||||||
|
readNextPacket(ref packetID, ref packetData);
|
||||||
|
|
||||||
|
if (packetID == 0x40) // Disconect
|
||||||
|
{
|
||||||
|
handler.OnConnectionLost(ChatBot.DisconnectReason.LoginRejected, ChatParser.ParseText(readNextString(ref packetData)));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
handlePacket(packetID, packetData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start network encryption. Automatically called by Login() if the server requests encryption.
|
/// Start network encryption. Automatically called by Login() if the server requests encryption.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -826,6 +862,16 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
else if (packetID == 0x02) //Login successful
|
else if (packetID == 0x02) //Login successful
|
||||||
{
|
{
|
||||||
login_phase = false;
|
login_phase = false;
|
||||||
|
|
||||||
|
if (forgeInfo != null)
|
||||||
|
{
|
||||||
|
// Do the forge handshake.
|
||||||
|
if (!CompleteForgeHandshake())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
StartUpdating();
|
StartUpdating();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue