From 627ad5aaf15e638026bbe0525e032e73b7d1fb42 Mon Sep 17 00:00:00 2001 From: Bas950 <34792838+Bas950@users.noreply.github.com> Date: Mon, 29 Jun 2020 16:16:22 +0200 Subject: [PATCH] Remove VarIntArray because I cannot read wiki's correctly xD --- .../Protocol/Handlers/DataTypes.cs | 21 ------------------- .../Protocol/Handlers/Protocol18.cs | 4 ++-- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/MinecraftClient/Protocol/Handlers/DataTypes.cs b/MinecraftClient/Protocol/Handlers/DataTypes.cs index 0b7ae768..7d262621 100644 --- a/MinecraftClient/Protocol/Handlers/DataTypes.cs +++ b/MinecraftClient/Protocol/Handlers/DataTypes.cs @@ -284,27 +284,6 @@ namespace MinecraftClient.Protocol.Handlers return i; } - /// - /// Read an integer from a cache of bytes and remove it from the cache - /// - /// Cache of bytes to read from - /// The integer - public int[] ReadNextVarIntArray(Queue cache) - { - string rawData = BitConverter.ToString(cache); - int i = 0; - int j = 0; - int k = 0; - while (true) - { - k = ReadNextByte(cache); - i |= (k & 0x7F) << j++ * 7; - if (j > 5) throw new OverflowException("VarInt too big " + rawData); - if ((k & 0x80) != 128) break; - } - return i; - } - /// /// Read an "extended short", which is actually an int of some kind, from the cache of bytes. /// This is only done with forge. It looks like it's a normal short, except that if the high diff --git a/MinecraftClient/Protocol/Handlers/Protocol18.cs b/MinecraftClient/Protocol/Handlers/Protocol18.cs index d9909966..84927dc1 100644 --- a/MinecraftClient/Protocol/Handlers/Protocol18.cs +++ b/MinecraftClient/Protocol/Handlers/Protocol18.cs @@ -225,7 +225,7 @@ namespace MinecraftClient.Protocol.Handlers if (protocolversion >= MC116Version) dataTypes.ReadNextVarInt(packetData); // World Count - 1.16 and above if (protocolversion >= MC116Version) - dataTypes.ReadNextVarIntArray(packetData); // World Names - 1.16 and above + dataTypes.ReadNextString(packetData); // World Names - 1.16 and above if (protocolversion >= MC116Version) dataTypes.ReadNextNbt(packetData); // Dimension Codec - 1.16 and above if (protocolversion >= MC191Version) @@ -241,7 +241,7 @@ namespace MinecraftClient.Protocol.Handlers if (protocolversion >= MC115Version) dataTypes.ReadNextLong(packetData); // Hashed world seed - 1.15 and above - dataTypes.ReadNextByte(packetData); // Max Players + dataTypes.ReadNextByte(packetData); // Max Players if (protocolversion < MC116Version) dataTypes.ReadNextString(packetData); // Level Type - 1.15 and below