Skip to content

Major rewrite

Compare
Choose a tag to compare
@Querz Querz released this 20 Aug 15:25
· 176 commits to master since this release
4644a3b

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 using TagFactory.registerCustomTag() now
  • removed NBTInputStream, as it was not doing anything special, use DataInputStream directly now
  • removed NBTOutputStream, as it was not doing anything special, use DataOutputStream directly now
  • removed util.Array
  • removed NBTFileWriter, use NBTUtil.readTag() instead
  • removed NBTFileReader, use NBTUtil.writeTag() instead
  • NBTUtil.readTag() and NBTUtil.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 tags
    • ListTag has some convenience methods to cast to specific types of ListTag, e.g. ListTag#asByteTagList() returns a ListTag<ByteTag> if you only have a ListTag<?>
  • custom tags now only have to extend Tag or any other class extending Tag
  • NumberTags don't expose Tag#getValue() anymore, use NumberTag#asByte(), NumberTag#asShort() etc. instead
  • NumberTags no longer throw an IllegalStateException when trying to convert a number of higher complexity to a number with lower complexity
  • renamed some methods to be more consistent in CompoundTag and ListTag
  • Tag#toString() now returns a json string with all information about the tag instead of the old custom notation
  • Tags no longer have a name, their name is now their key if they are stored inside of a CompoundTag
  • 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