Implement 1.12.1 protocol

This commit is contained in:
Pokechu22 2017-08-01 10:34:16 -07:00 committed by ORelio
parent 933a02800a
commit fd2e3d5797
3 changed files with 46 additions and 5 deletions

View file

@ -20,9 +20,9 @@ namespace MinecraftClient
private static McTcpClient Client; private static McTcpClient Client;
public static string[] startupargs; public static string[] startupargs;
public const string Version = "1.12.0 DEV"; public const string Version = "1.12.1 DEV";
public const string MCLowestVersion = "1.4.6"; public const string MCLowestVersion = "1.4.6";
public const string MCHighestVersion = "1.12.0"; public const string MCHighestVersion = "1.12.1";
private static Thread offlinePrompt = null; private static Thread offlinePrompt = null;
private static bool useMcVersionOnce = false; private static bool useMcVersionOnce = false;

View file

@ -24,6 +24,7 @@ namespace MinecraftClient.Protocol.Handlers
private const int MC111Version = 315; private const int MC111Version = 315;
private const int MC17w13aVersion = 318; private const int MC17w13aVersion = 318;
private const int MC112pre5Version = 332; private const int MC112pre5Version = 332;
private const int MC17w31aVersion = 336;
private int compression_treshold = 0; private int compression_treshold = 0;
private bool autocomplete_received = false; private bool autocomplete_received = false;
@ -230,7 +231,7 @@ namespace MinecraftClient.Protocol.Handlers
default: return PacketIncomingType.UnknownPacket; default: return PacketIncomingType.UnknownPacket;
} }
} }
else else if (protocol < MC17w31aVersion)
{ {
switch (packetID) switch (packetID)
{ {
@ -253,6 +254,29 @@ namespace MinecraftClient.Protocol.Handlers
default: return PacketIncomingType.UnknownPacket; default: return PacketIncomingType.UnknownPacket;
} }
} }
else
{
switch (packetID)
{
case 0x1F: return PacketIncomingType.KeepAlive;
case 0x23: return PacketIncomingType.JoinGame;
case 0x0F: return PacketIncomingType.ChatMessage;
case 0x35: return PacketIncomingType.Respawn;
case 0x2F: return PacketIncomingType.PlayerPositionAndLook;
case 0x20: return PacketIncomingType.ChunkData;
case 0x10: return PacketIncomingType.MultiBlockChange;
case 0x0B: return PacketIncomingType.BlockChange;
//MapChunkBulk removed in 1.9
case 0x1D: return PacketIncomingType.UnloadChunk;
case 0x2E: return PacketIncomingType.PlayerListUpdate;
case 0x0E: return PacketIncomingType.TabCompleteResult;
case 0x18: return PacketIncomingType.PluginMessage;
case 0x1A: return PacketIncomingType.KickPacket;
//NetworkCompressionTreshold removed in 1.9
case 0x34: return PacketIncomingType.ResourcePackSend;
default: return PacketIncomingType.UnknownPacket;
}
}
} }
/// <summary> /// <summary>
@ -324,7 +348,7 @@ namespace MinecraftClient.Protocol.Handlers
case PacketOutgoingType.PlayerPositionAndLook: return 0x0E; case PacketOutgoingType.PlayerPositionAndLook: return 0x0E;
} }
} }
else else if (protocol < MC17w31aVersion)
{ {
switch (packet) switch (packet)
{ {
@ -339,6 +363,21 @@ namespace MinecraftClient.Protocol.Handlers
case PacketOutgoingType.PlayerPositionAndLook: return 0x0F; case PacketOutgoingType.PlayerPositionAndLook: return 0x0F;
} }
} }
else
{
switch (packet)
{
case PacketOutgoingType.KeepAlive: return 0x0B;
case PacketOutgoingType.ResourcePackStatus: return 0x17;
case PacketOutgoingType.ChatMessage: return 0x02;
case PacketOutgoingType.ClientStatus: return 0x03;
case PacketOutgoingType.ClientSettings: return 0x04;
case PacketOutgoingType.PluginMessage: return 0x09;
case PacketOutgoingType.TabComplete: return 0x01;
case PacketOutgoingType.PlayerPosition: return 0x0D;
case PacketOutgoingType.PlayerPositionAndLook: return 0x0E;
}
}
throw new System.ComponentModel.InvalidEnumArgumentException("Unknown PacketOutgoingType (protocol=" + protocol + ")", (int)packet, typeof(PacketOutgoingType)); throw new System.ComponentModel.InvalidEnumArgumentException("Unknown PacketOutgoingType (protocol=" + protocol + ")", (int)packet, typeof(PacketOutgoingType));
} }

View file

@ -106,7 +106,7 @@ namespace MinecraftClient.Protocol
int[] supportedVersions_Protocol16 = { 51, 60, 61, 72, 73, 74, 78 }; int[] supportedVersions_Protocol16 = { 51, 60, 61, 72, 73, 74, 78 };
if (Array.IndexOf(supportedVersions_Protocol16, ProtocolVersion) > -1) if (Array.IndexOf(supportedVersions_Protocol16, ProtocolVersion) > -1)
return new Protocol16Handler(Client, ProtocolVersion, Handler); return new Protocol16Handler(Client, ProtocolVersion, Handler);
int[] supportedVersions_Protocol18 = { 4, 5, 47, 107, 108, 109, 110, 210, 315, 316, 335 }; int[] supportedVersions_Protocol18 = { 4, 5, 47, 107, 108, 109, 110, 210, 315, 316, 335, 338 };
if (Array.IndexOf(supportedVersions_Protocol18, ProtocolVersion) > -1) if (Array.IndexOf(supportedVersions_Protocol18, ProtocolVersion) > -1)
return new Protocol18Handler(Client, ProtocolVersion, Handler, forgeInfo); return new Protocol18Handler(Client, ProtocolVersion, Handler, forgeInfo);
throw new NotSupportedException("The protocol version no." + ProtocolVersion + " is not supported."); throw new NotSupportedException("The protocol version no." + ProtocolVersion + " is not supported.");
@ -185,6 +185,8 @@ namespace MinecraftClient.Protocol
case "1.12": case "1.12":
case "1.12.0": case "1.12.0":
return 335; return 335;
case "1.12.1":
return 338;
default: default:
return 0; return 0;
} }