Skip to content

Releases: pmmp/NBT

1.2.0

19 Sep 22:35
51b8d6a

Choose a tag to compare

Changes since 1.1.x

  • ListTag now uses PHPStan generic types. By default, a ListTag will be ListTag<Tag>.
  • CompoundTag::getListTag() now supports checking the type of list via a string $tagClass parameter.
    • This uses PHPStan generic inference, so e.g. doing getListTag("name", StringTag::class) will return ListTag<StringTag>|null.
    • An UnexpectedTagTypeException will be thrown if the tag is a list of a different type.
  • Added ListTag::cast(), which accepts a string $tagClass and returns null if the list type doesn't match. This uses PHPStan generic inference, so e.g. doing cast(StringTag::class) will return ListTag<StringTag>|null.
  • ListTag PHPStan generics will be narrowed by doing any of the following: passing a non-empty array to the constructor, push(), unshift(), set()

Note: If you don't use PHPStan, you won't be affected. These changes mostly benefit static analysis.

1.1.1

09 Mar 01:56
c3c7b0a

Choose a tag to compare

Changes since 1.1.0

  • CompoundTag->setTag() now checks that the given name is no more than 32767 bytes - previously these oversized names were accepted, but would cause a crash on encoding
  • TreeRoot->__construct() now checks that the given name is no more than 32767 bytes, for the same reason

1.1.0

09 Mar 01:54
cfd53a8

Choose a tag to compare

Changes since 1.0.x

Performance

  • Significantly improved performance of CompoundTag->equals() and ListTag->equals()

Changes to ListTag

  • ListTag now uses array internally instead of SplDoublyLinkedList, which improves performance for typical usage patterns
  • Empty ListTag will now always take the type of the first value inserted, regardless of the type set. e.g. inserting a TAG_Int into an empty list of TAG_Byte is now allowed, and will change the list's type to TAG_Int.
  • Deprecated ListTag->setTagType() - this is now useless as the type will always be inferred from the first value inserted
  • Fixed empty ListTags which were not of type TAG_End being forcibly converted to TAG_End - this caused asymmetry of decode/encode on older data

1.0.1

07 Jan 22:50
53db374

Choose a tag to compare

Changes since 1.0.0

  • Improved PHPStan doc types for functions working with arrays.
  • Now analyzed by PHPStan 2.x on level 10.

1.0.0

03 Aug 15:29
2054027

Choose a tag to compare

Changes since 0.3.4

  • Added BaseNbtSerializer->readHeadless() and BaseNbtSerializer->writeHeadless(). These are needed for one specific place in the Bedrock protocol and are otherwise not usually seen.

Despite the version bump to 1.0.0, this isn't a huge release. Staying on 0.x for so long was a mistake that needed to be corrected.

0.3.4

10 Apr 11:36
62c0246

Choose a tag to compare

Changes since 0.3.3

  • Fixed crashes when encountering TAG_ByteArray or TAG_IntArray with length larger than int32 max. NbtDataException is now thrown in these cases.

0.3.3

06 Jul 14:16
f4321be

Choose a tag to compare

Changes since 0.3.2

  • JsonNbtParser no longer throws InvalidArgumentException when attempting to create tags with out-of-bounds values (e.g. TAG_Byte with value larger than a byte) - NbtDataException is now thrown instead.
  • JsonNbtParser no longer throws TypeError when attempting to create TAG_List with mixed value types - NbtDataException is now thrown instead.

0.3.2

16 Dec 01:27
3e0d9ef

Choose a tag to compare

Changes since 0.3.1

  • TAG_Compounds containing repeated keys in binary data is no longer treated as a corruption case. While it technically is corruption, it's problematic to throw on it due to inability to recover the data using this library.

0.2.19

16 Dec 01:27
8567c65

Choose a tag to compare

Changes since 0.2.18

  • TAG_Compounds containing repeated keys in binary data is no longer treated as a corruption case. While it technically is corruption, it's problematic due to inability to recover the data using this library.

0.3.1

06 Dec 16:23
f43db89

Choose a tag to compare

Changes since 0.3.0

  • Fixed UnexpectedValueException being thrown instead of NbtDataException when encountering a non-empty list of TAG_End.