Add support for 1.16.4 (#1311)

This commit is contained in:
DanisDGK 2020-11-03 20:04:34 +02:00 committed by GitHub
parent 0c3f774c07
commit bea5161d6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 8 deletions

View file

@ -32,7 +32,7 @@ namespace MinecraftClient
public const string Version = MCHighestVersion; public const string Version = MCHighestVersion;
public const string MCLowestVersion = "1.4.6"; public const string MCLowestVersion = "1.4.6";
public const string MCHighestVersion = "1.16.3"; public const string MCHighestVersion = "1.16.4";
public static readonly string BuildInfo = null; public static readonly string BuildInfo = null;
private static Thread offlinePrompt = null; private static Thread offlinePrompt = null;

View file

@ -39,7 +39,7 @@ namespace MinecraftClient.Protocol.Handlers
/// <returns></returns> /// <returns></returns>
public PacketTypePalette GetTypeHandler(int protocol) public PacketTypePalette GetTypeHandler(int protocol)
{ {
if (protocol > Protocol18Handler.MC1163Version) if (protocol > Protocol18Handler.MC1164Version)
throw new NotImplementedException(Translations.Get("exception.palette.packet")); throw new NotImplementedException(Translations.Get("exception.palette.packet"));
if (protocol <= Protocol18Handler.MC18Version) if (protocol <= Protocol18Handler.MC18Version)
return new PacketPalette17(); return new PacketPalette17();

View file

@ -47,6 +47,7 @@ namespace MinecraftClient.Protocol.Handlers
internal const int MC1161Version = 736; internal const int MC1161Version = 736;
internal const int MC1162Version = 751; internal const int MC1162Version = 751;
internal const int MC1163Version = 753; internal const int MC1163Version = 753;
internal const int MC1164Version = 754;
private int compression_treshold = 0; private int compression_treshold = 0;
private bool autocomplete_received = false; private bool autocomplete_received = false;
@ -85,13 +86,13 @@ namespace MinecraftClient.Protocol.Handlers
handler.SetTerrainEnabled(false); handler.SetTerrainEnabled(false);
} }
if (handler.GetInventoryEnabled() && (protocolversion < MC110Version || protocolversion > MC1163Version)) if (handler.GetInventoryEnabled() && (protocolversion < MC110Version || protocolversion > MC1164Version))
{ {
Translations.WriteLineFormatted("extra.inventory_disabled"); Translations.WriteLineFormatted("extra.inventory_disabled");
handler.SetInventoryEnabled(false); handler.SetInventoryEnabled(false);
} }
if (handler.GetEntityHandlingEnabled() && (protocolversion < MC110Version || protocolversion > MC1163Version)) if (handler.GetEntityHandlingEnabled() && (protocolversion < MC110Version || protocolversion > MC1164Version))
{ {
Translations.WriteLineFormatted("extra.entity_disabled"); Translations.WriteLineFormatted("extra.entity_disabled");
handler.SetEntityHandlingEnabled(false); handler.SetEntityHandlingEnabled(false);
@ -113,7 +114,7 @@ namespace MinecraftClient.Protocol.Handlers
// Entity palette // Entity palette
if (protocolversion >= MC113Version) if (protocolversion >= MC113Version)
{ {
if (protocolversion > MC1163Version && handler.GetEntityHandlingEnabled()) if (protocolversion > MC1164Version && handler.GetEntityHandlingEnabled())
throw new NotImplementedException(Translations.Get("exception.palette.entity")); throw new NotImplementedException(Translations.Get("exception.palette.entity"));
if (protocolversion >= MC1162Version) if (protocolversion >= MC1162Version)
entityPalette = new EntityPalette1162(); entityPalette = new EntityPalette1162();
@ -130,7 +131,7 @@ namespace MinecraftClient.Protocol.Handlers
// Item palette // Item palette
if (protocolversion >= MC116Version) if (protocolversion >= MC116Version)
{ {
if (protocolversion > MC1163Version && handler.GetInventoryEnabled()) if (protocolversion > MC1164Version && handler.GetInventoryEnabled())
throw new NotImplementedException(Translations.Get("exception.palette.item")); throw new NotImplementedException(Translations.Get("exception.palette.item"));
if (protocolversion >= MC1162Version) if (protocolversion >= MC1162Version)
itemPalette = new ItemPalette1162(); itemPalette = new ItemPalette1162();

View file

@ -126,7 +126,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, 338, 340, 393, 401, 404, 477, 480, 485, 490, 498, 573, 575, 578, 735, 736, 751, 753 }; int[] supportedVersions_Protocol18 = { 4, 5, 47, 107, 108, 109, 110, 210, 315, 316, 335, 338, 340, 393, 401, 404, 477, 480, 485, 490, 498, 573, 575, 578, 735, 736, 751, 753, 754 };
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(Translations.Get("exception.version_unsupport", ProtocolVersion)); throw new NotSupportedException(Translations.Get("exception.version_unsupport", ProtocolVersion));
@ -242,6 +242,8 @@ namespace MinecraftClient.Protocol
return 751; return 751;
case "1.16.3": case "1.16.3":
return 753; return 753;
case "1.16.4":
return 754;
default: default:
return 0; return 0;
} }