mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Add support for Minecraft Settings
- Add Minecraft vanilla settings from Settings screen - These settings are sent to server when joining - Allows to customize skin layers shown to other players - Most other settings are ignored by servers - Update language file from 1.9 to 1.10 version - Minor aesthetic changes in INI file comments Suggestion by TNT-UP in issue #161 and Splodger1 in MC Forum.
This commit is contained in:
parent
b1d4f85b23
commit
61ce935c63
5 changed files with 192 additions and 38 deletions
|
|
@ -1469,6 +1469,42 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
return SendPluginChannelPacket("MC|Brand", getString(brandInfo));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inform the server of the client's Minecraft settings
|
||||
/// </summary>
|
||||
/// <param name="language">Client language eg en_US</param>
|
||||
/// <param name="viewDistance">View distance, in chunks</param>
|
||||
/// <param name="difficulty">Game difficulty (client-side...)</param>
|
||||
/// <param name="chatMode">Chat mode (allows muting yourself)</param>
|
||||
/// <param name="chatColors">Show chat colors</param>
|
||||
/// <param name="skinParts">Show skin layers</param>
|
||||
/// <param name="mainHand">1.9+ main hand</param>
|
||||
/// <returns>True if client settings were successfully sent</returns>
|
||||
public bool SendClientSettings(string language, byte viewDistance, byte difficulty, byte chatMode, bool chatColors, byte skinParts, byte mainHand)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<byte> fields = new List<byte>();
|
||||
fields.AddRange(getString(language));
|
||||
fields.Add(viewDistance);
|
||||
fields.AddRange(protocolversion >= MC19Version
|
||||
? getVarInt(chatMode)
|
||||
: new byte[] { chatMode });
|
||||
fields.Add(chatColors ? (byte)1 : (byte)0);
|
||||
if (protocolversion < MC18Version)
|
||||
{
|
||||
fields.Add(difficulty);
|
||||
fields.Add((byte)(skinParts & 0x1)); //show cape
|
||||
}
|
||||
else fields.Add(skinParts);
|
||||
if (protocolversion >= MC19Version)
|
||||
fields.AddRange(getVarInt(mainHand));
|
||||
SendPacket(protocolversion >= MC19Version ? 0x04 : 0x15, fields);
|
||||
}
|
||||
catch (SocketException) { }
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send a location update to the server
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue