From f66fb3b09572a9698d2d79bfc2cd4638170c6dcb Mon Sep 17 00:00:00 2001 From: Milutinke Date: Fri, 19 Aug 2022 22:14:14 +0200 Subject: [PATCH 1/3] Fixed the chat not working bellow 1.16.5. Tested and working. --- .../Protocol/Handlers/Protocol18.cs | 43 ++++++++++--------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/MinecraftClient/Protocol/Handlers/Protocol18.cs b/MinecraftClient/Protocol/Handlers/Protocol18.cs index ceb9a709..dce081e0 100644 --- a/MinecraftClient/Protocol/Handlers/Protocol18.cs +++ b/MinecraftClient/Protocol/Handlers/Protocol18.cs @@ -117,13 +117,13 @@ namespace MinecraftClient.Protocol.Handlers if (protocolVersion >= MC_1_17_Version) Block.Palette = new Palette117(); else if (protocolVersion >= MC_1_16_Version) - if (protocolVersion >= MC_1_16_Version) - Block.Palette = new Palette116(); - else if (protocolVersion >= MC_1_15_Version) - Block.Palette = new Palette115(); - else if (protocolVersion >= MC_1_14_Version) - Block.Palette = new Palette114(); - else Block.Palette = new Palette113(); + if (protocolVersion >= MC_1_16_Version) + Block.Palette = new Palette116(); + else if (protocolVersion >= MC_1_15_Version) + Block.Palette = new Palette115(); + else if (protocolVersion >= MC_1_14_Version) + Block.Palette = new Palette114(); + else Block.Palette = new Palette113(); } else Block.Palette = new Palette112(); @@ -135,15 +135,15 @@ namespace MinecraftClient.Protocol.Handlers if (protocolversion >= MC_1_17_Version) entityPalette = new EntityPalette117(); else if (protocolversion >= MC_1_16_2_Version) - if (protocolversion >= MC_1_16_2_Version) - entityPalette = new EntityPalette1162(); - else if (protocolversion >= MC_1_16_Version) - entityPalette = new EntityPalette1161(); - else if (protocolversion >= MC_1_15_Version) - entityPalette = new EntityPalette115(); - else if (protocolVersion >= MC_1_14_Version) - entityPalette = new EntityPalette114(); - else entityPalette = new EntityPalette113(); + if (protocolversion >= MC_1_16_2_Version) + entityPalette = new EntityPalette1162(); + else if (protocolversion >= MC_1_16_Version) + entityPalette = new EntityPalette1161(); + else if (protocolversion >= MC_1_15_Version) + entityPalette = new EntityPalette115(); + else if (protocolVersion >= MC_1_14_Version) + entityPalette = new EntityPalette114(); + else entityPalette = new EntityPalette113(); } else entityPalette = new EntityPalette112(); @@ -157,9 +157,9 @@ namespace MinecraftClient.Protocol.Handlers else if (protocolversion >= MC_1_17_Version) itemPalette = new ItemPalette117(); else if (protocolversion >= MC_1_16_2_Version) - if (protocolversion >= MC_1_16_2_Version) - itemPalette = new ItemPalette1162(); - else itemPalette = new ItemPalette1161(); + if (protocolversion >= MC_1_16_2_Version) + itemPalette = new ItemPalette1162(); + else itemPalette = new ItemPalette1161(); } else itemPalette = new ItemPalette115(); } @@ -401,7 +401,10 @@ namespace MinecraftClient.Protocol.Handlers if ((messageType == 1 && !Settings.DisplaySystemMessages) || (messageType == 2 && !Settings.DisplayXPBarMessages)) break; - senderUUID = dataTypes.ReadNextUUID(packetData); + + if (protocolversion >= MC_1_16_5_Version) + senderUUID = dataTypes.ReadNextUUID(packetData); + else senderUUID = Guid.Empty; } else senderUUID = Guid.Empty; From 2f90c8a67dd7b08dbd95c2d8f079c0f3e7cf16a1 Mon Sep 17 00:00:00 2001 From: Milutinke Date: Fri, 19 Aug 2022 22:33:09 +0200 Subject: [PATCH 2/3] Fixed a crash on 1.19 when joining. --- MinecraftClient/Protocol/Handlers/Protocol18.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MinecraftClient/Protocol/Handlers/Protocol18.cs b/MinecraftClient/Protocol/Handlers/Protocol18.cs index dce081e0..c1f45e64 100644 --- a/MinecraftClient/Protocol/Handlers/Protocol18.cs +++ b/MinecraftClient/Protocol/Handlers/Protocol18.cs @@ -334,7 +334,10 @@ namespace MinecraftClient.Protocol.Handlers if (protocolversion >= MC_1_16_Version) { if (protocolversion >= MC_1_19_Version) + { dataTypes.ReadNextString(packetData); // Dimension Type: Identifier + currentDimensionType = new Dictionary(); + } else if (protocolversion >= MC_1_16_2_Version) currentDimensionType = dataTypes.ReadNextNbt(packetData); // Dimension Type: NBT Tag Compound else From fdbd77c33da40fc4cbb9e05003c22d3910397b5e Mon Sep 17 00:00:00 2001 From: Milutinke Date: Fri, 19 Aug 2022 22:47:21 +0200 Subject: [PATCH 3/3] Fixed the crash on Respawn packet. Again the Dimension Type dictionary was not instantiated. --- MinecraftClient/Protocol/Handlers/Protocol18.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MinecraftClient/Protocol/Handlers/Protocol18.cs b/MinecraftClient/Protocol/Handlers/Protocol18.cs index c1f45e64..ecb3dfed 100644 --- a/MinecraftClient/Protocol/Handlers/Protocol18.cs +++ b/MinecraftClient/Protocol/Handlers/Protocol18.cs @@ -450,7 +450,10 @@ namespace MinecraftClient.Protocol.Handlers if (protocolversion >= MC_1_16_Version) { if (protocolversion >= MC_1_19_Version) + { dataTypes.ReadNextString(packetData); // Dimension Type: Identifier + dimensionTypeInRespawn = new Dictionary(); + } else if (protocolversion >= MC_1_16_2_Version) dimensionTypeInRespawn = dataTypes.ReadNextNbt(packetData); // Dimension Type: NBT Tag Compound else