Send MC|Brand information upon joining the game

This commit is contained in:
Pokechu22 2015-08-22 14:26:56 -07:00
parent 344749ead2
commit 9fefcb40ef

View file

@ -139,6 +139,9 @@ namespace MinecraftClient.Protocol.Handlers
case 0x00: //Keep-Alive
SendPacket(0x00, packetData);
break;
case 0x01: //Join game
SendBrandInfo();
break;
case 0x02: //Chat message
handler.OnTextReceived(ChatParser.ParseText(readNextString(ref packetData)));
break;
@ -607,6 +610,20 @@ namespace MinecraftClient.Protocol.Handlers
}
}
/// <summary>
/// Sends information about the client version.
/// </summary>
private void SendBrandInfo()
{
byte[] channel = Encoding.UTF8.GetBytes("MC|Brand");
byte[] channelLen = getVarInt(channel.Length);
byte[] brand = Encoding.UTF8.GetBytes("Minecraft Console Client v" + Program.Version);
byte[] brandLen = getVarInt(brand.Length);
SendPacket(0x17, concatBytes(channelLen, channel, brandLen, brand));
}
/// <summary>
/// Send a chat message to the server
/// </summary>