Fixed Metadata throwing an exception

This commit is contained in:
Anon 2023-03-28 17:56:35 +02:00
parent 0b98628572
commit 1901f4b62d

View file

@ -645,12 +645,11 @@ namespace MinecraftClient.Protocol.Handlers
while (key != terminteValue) while (key != terminteValue)
{ {
if (protocolversion <= Protocol18Handler.MC_1_8_Version)
key = (byte)(key & 0x1f);
int typeId = protocolversion <= Protocol18Handler.MC_1_8_Version int typeId = protocolversion <= Protocol18Handler.MC_1_8_Version
? key >> 5 // 1.8 ? key >> 5 // 1.8
: ReadNextVarInt(cache); // 1.9+ : ReadNextVarInt(cache); // 1.9+
EntityMetaDataType type; EntityMetaDataType type;
try try
{ {
@ -661,6 +660,9 @@ namespace MinecraftClient.Protocol.Handlers
throw new System.IO.InvalidDataException("Unknown Metadata Type ID " + typeId + ". Is this up to date for new MC Version?"); throw new System.IO.InvalidDataException("Unknown Metadata Type ID " + typeId + ". Is this up to date for new MC Version?");
} }
if (protocolversion <= Protocol18Handler.MC_1_8_Version)
key = (byte)(key & 0x1f);
// Value's data type is depended on Type // Value's data type is depended on Type
object? value = null; object? value = null;