Skip to content

Amulet NBT v1.0.0

Compare
Choose a tag to compare
@Podshot Podshot released this 20 Nov 21:11

Initial release of the Amulet-NBT library

This library is a continuation and port of the old PyMCLevel NBT library to Python 3.7. However, this library also has additional features and departures.

Changes

  • Loaded NBT files are now contained in a NBTFile object which allows for the setting of the root name for NBT/DAT files
    • NBTFile objects act as a wrapper around TAG_Compound objects, so accessing top-level keys from the NBTFile object will work the same as it would from the TAG_Compound object
  • Little endian support is no longer a context specific mode or state, little and big endian files can be saved and loaded via boolean flags to the respective methods
  • NBT arrays, such as TAG_Int_Array and TAG_Long_Array, do not immediately cast the supplied array to the required dtype for that tag array, but will cast to appropriate dtype when saving in both little and big endian mode
  • All NBT Tag objects have a to_snbt() method which return the object's value as a valid SNBT string as outlined on the Minecraft NBT Wiki page
  • A from_snbt() method was added to parse full NBT tag objects from a given SNBT string
  • A pure python implementation is also present and will be used instead if the cython version cannot be loaded
    • If you wish to know which version was loaded, the amulet_nbt.IMPLEMENTATION attribute will return "cython" for the cython version and "python" for the pure-python one.