Skip to content

v1.2.0

Latest

Choose a tag to compare

@m-stilling m-stilling released this 27 Sep 09:53
· 1 commit to main since this release

Behavior changes

  • Numbers outside the range of their type now throw SNBTParseException, for example 300b, 1.5b and 1e400.
  • Tag constructors and intsToUuid() now throw SNBTInvalidArgumentException for values outside the range, and for INF and NaN.
  • Unquoted values such as 0x1F, 0b101 and 1_000 are now numbers, not strings.
  • CompoundTag::getIterator() returns \Iterator, not \ArrayIterator. All keys are strings.
  • Classes that extend Tag must add the bool $escapeControlCharacters parameter to render(). They must also add it to quote(), serializeKey() and toSnbt() if they override them.

Added

  • Typed getters on CompoundTag and ListTag: getString(), getInt(), getFloat(), getBool(), getCompound(), getList() and getAs().
  • SNBTParser::parseCompound() returns a CompoundTag.
  • Tag::fromPhp() makes tags from PHP values.
  • with(), without() and withAppended() return a changed copy of a compound or a list.
  • SNBTParseException has position, lineNumber and columnNumber.
  • The parser reads the Minecraft 1.21.5 syntax: hexadecimal and binary numbers, _ in numbers, the new string escapes, trailing commas, and bool() and uuid().
  • toSnbt(escapeControlCharacters: true) writes control characters as escapes.
  • MIN and MAX constants on the integer tags, and NumberArrayTag::elementType().

Fixed

  • toSnbt() output with a line feed, a carriage return or a tab now parses on Minecraft 1.21.4 and earlier.
  • Every exception that the package throws implements SNBTException.
  • Iterating a CompoundTag gives string keys, also for numeric keys.

Package

  • The package archive does not contain composer.lock.
  • composer.json suggests ext-intl.

Full Changelog: v1.1.0...v1.2.0