Major rewrite
This release contains a major rewrite and cleanup of the NBT library.
Warning
Version 2.0 is not compatible with older versions of this NBT library.
Changes
- removed
TagType
, custom tags are registered usingTagFactory.registerCustomTag()
now - removed
NBTInputStream
, as it was not doing anything special, useDataInputStream
directly now - removed
NBTOutputStream
, as it was not doing anything special, useDataOutputStream
directly now - removed
util.Array
- removed
NBTFileWriter
, useNBTUtil.readTag()
instead - removed
NBTFileReader
, useNBTUtil.writeTag()
instead NBTUtil.readTag()
andNBTUtil.writeTag()
can now throw an IOException that should be handled by the developer individually- removed
CustomTag
interface - added
TagFactory
for creating tags from IDs - tags now use generics
ListTag
now has a generic type, e.g.ListTag
for a list of byte tagsListTag
has some convenience methods to cast to specific types ofListTag
, e.g.ListTag#asByteTagList()
returns aListTag<ByteTag>
if you only have aListTag<?>
- custom tags now only have to extend
Tag
or any other class extendingTag
NumberTag
s don't exposeTag#getValue()
anymore, useNumberTag#asByte()
,NumberTag#asShort()
etc. insteadNumberTag
s no longer throw anIllegalStateException
when trying to convert a number of higher complexity to a number with lower complexity- renamed some methods to be more consistent in
CompoundTag
andListTag
Tag#toString()
now returns a json string with all information about the tag instead of the old custom notationTag
s no longer have a name, their name is now their key if they are stored inside of aCompoundTag
- wrote the unit tests more consistent and easier to understand
- made sure that null checks are used in the right places
- changed the version to 2.0