KyoriPowered / adventure

A user-interface library, formerly known as text, for Minecraft: Java Edition
https://docs.advntr.dev/
MIT License
721 stars 107 forks source link

Issues with vanilla minecraft nbt handling #810

Open ghost opened 2 years ago

ghost commented 2 years ago

Hello, I am having issues with adventure-nbt. I need to read a nbt tag that may be an end tag or a compound tag out of a DataInput, it should be null if it is an end tag and the compound tag if it is the compound tag and the whole tag should be read out of the DataInput.

This behaviour is normal for minecraft vanilla so it would be good if something like this will be implemented soon.

I am using BinaryTagIO.reader().read(...) and the error is: java.io.IOException: Expected root tag to be a BinaryTagType[CompoundBinaryTag 10], was BinaryTagType[EndBinaryTag 0]

ghost commented 2 years ago

bump

zml2008 commented 1 year ago

Looking at vanilla, plain NBT does not treat solely an EndTag as null -- that's a special case for the network protocol as handled via FriendlyByteBuf.

We could add overloads to BinaryTagIO for this special behavior, but we already have quite a few overloads so I'm not sure if it's worth the added mess.