requireTag() should mention what tag was actually encountered
skairunner opened this issue ยท 4 comments
Versions
WorldEdit version: 7.2.0
Platform version: Forge 33.0.37
Describe the bug
When trying to load a Schematic with the wrong tag type (e.g. something that's not ByteTagArray for BlockData) the error message only says what tag is required, not what tag is needed.
This message is generated at this line.
It would be helpful for me, developing a program that aims to produce a schematic file in a format compatible with WorldEdit, if the error message mentioned what tag type was actually found. It should be a one-line change.
To Reproduce
- Load a schematic file with an invalid tag (like the attached one) with worldedit
- Observe the log messages. It should say something like:
[20:04:22] [WorldEdit Task Executor - 4/ERROR]: Uncaught exception occurred in task: Loading schematic scout.schematic
java.io.IOException: BlockData tag is not of tag type com.sk89q.jnbt.ByteArrayTag
at com.sk89q.worldedit.extent.clipboard.io.NBTSchematicReader.requireTag(NBTSchematicReader.java:40) ~[?:?]
Expected behavior
An error message like this:
[20:04:22] [WorldEdit Task Executor - 4/ERROR]: Uncaught exception occurred in task: Loading schematic scout.schematic
java.io.IOException: BlockData tag is of tag type com.sk89q.jnbt.IntArrayTag, expected tag type com.sk89q.jnbt.ByteArrayTag
at com.sk89q.worldedit.extent.clipboard.io.NBTSchematicReader.requireTag(NBTSchematicReader.java:40) ~[?:?]
Additional context
This is the file that I am attempting to load:
It's uploaded as a zip because that's what github allows. WorldEdit says that it was expecting a ByteArrayTag for BlockData, and I am pretty sure that that's what I am outputting, but being able to see what WorldEdit actually got from BlockData would be very useful.
NBT Explorer isn't the clearest -- there's no documentation I could easily find for what each icon means, and "three dots with three bars" with "page with b" inside almost feels like it could be a ByteArray.
I also wonder if a ListTag of ByteTags should be equivalent to a ByteArrayTag. That said, clearly the nbt library I was using (Rust hematite_nbt) incorrectly converts ByteArrayTag to ListTag of ByteTag so I can look into that. Thanks for the prompt reply.
Yes, that's fair, though it is using nearly the same icons as https://minecraft.gamepedia.com/NBT_format, so it's not that obscure.