Skip to content

Commit

Permalink
Fixed Metadata throwing an exception
Browse files Browse the repository at this point in the history
  • Loading branch information
milutinke committed Mar 28, 2023
1 parent 0b98628 commit 1901f4b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions MinecraftClient/Protocol/Handlers/DataTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -645,12 +645,11 @@ private object ReadNbtField(Queue<byte> cache, int fieldType)

while (key != terminteValue)
{
if (protocolversion <= Protocol18Handler.MC_1_8_Version)
key = (byte)(key & 0x1f);

int typeId = protocolversion <= Protocol18Handler.MC_1_8_Version
? key >> 5 // 1.8
: ReadNextVarInt(cache); // 1.9+


EntityMetaDataType type;
try
{
Expand All @@ -660,6 +659,9 @@ private object ReadNbtField(Queue<byte> cache, int fieldType)
{
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
object? value = null;
Expand Down

0 comments on commit 1901f4b

Please sign in to comment.