Releases: pmmp/NBT
Releases · pmmp/NBT
1.2.0
Changes since 1.1.x
ListTagnow uses PHPStan generic types. By default, aListTagwill beListTag<Tag>.CompoundTag::getListTag()now supports checking the type of list via astring $tagClassparameter.- This uses PHPStan generic inference, so e.g. doing
getListTag("name", StringTag::class)will returnListTag<StringTag>|null. - An
UnexpectedTagTypeExceptionwill be thrown if the tag is a list of a different type.
- This uses PHPStan generic inference, so e.g. doing
- Added
ListTag::cast(), which accepts astring $tagClassand returnsnullif the list type doesn't match. This uses PHPStan generic inference, so e.g. doingcast(StringTag::class)will returnListTag<StringTag>|null. ListTagPHPStan 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
Changes since 1.1.0
CompoundTag->setTag()now checks that the givennameis no more than 32767 bytes - previously these oversized names were accepted, but would cause a crash on encodingTreeRoot->__construct()now checks that the givennameis no more than 32767 bytes, for the same reason
1.1.0
Changes since 1.0.x
Performance
- Significantly improved performance of
CompoundTag->equals()andListTag->equals()
Changes to ListTag
ListTagnow usesarrayinternally instead ofSplDoublyLinkedList, which improves performance for typical usage patterns- Empty
ListTagwill now always take the type of the first value inserted, regardless of the type set. e.g. inserting aTAG_Intinto an empty list ofTAG_Byteis now allowed, and will change the list's type toTAG_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 typeTAG_Endbeing forcibly converted toTAG_End- this caused asymmetry of decode/encode on older data
1.0.1
1.0.0
Changes since 0.3.4
- Added
BaseNbtSerializer->readHeadless()andBaseNbtSerializer->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
0.3.3
Changes since 0.3.2
JsonNbtParserno longer throwsInvalidArgumentExceptionwhen attempting to create tags with out-of-bounds values (e.g. TAG_Byte with value larger than a byte) -NbtDataExceptionis now thrown instead.JsonNbtParserno longer throwsTypeErrorwhen attempting to createTAG_Listwith mixed value types -NbtDataExceptionis now thrown instead.