-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Reading from Buffer object - Writing to Buffer object - Converting from/to python objects 100% test coverage for the nbt.py, Pyright and Ruff are happy
- Loading branch information
1 parent
2836898
commit f079cf3
Showing
3 changed files
with
2,400 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
- Added the `NBTag` to deal with NBT data: | ||
- The `NBTag` class is the base class for all NBT tags and provides the basic functionality to serialize and deserialize NBT data from and to a `Buffer` object. | ||
- The classes `EndNBT`, `ByteNBT`, `ShortNBT`, `IntNBT`, `LongNBT`, `FloatNBT`, `DoubleNBT`, `ByteArrayNBT`, `StringNBT`, `ListNBT`, `CompoundNBT`, `IntArrayNBT`and `LongArrayNBT` were added and correspond to the NBT types described in the [NBT specification](https://wiki.vg/NBT#Specification). | ||
- NBT tags can be created using the `NBTag.from_object()` method, which automatically selects the correct tag type based on the object's type and works recursively for lists and dictionaries. | ||
- The `NBTag.to_object()` method can be used to convert an NBT tag back to a Python object. | ||
- The `NBTag.serialize()` can be used to serialize an NBT tag to a new `Buffer` object. | ||
- The `NBTag.deserialize(buffer)` can be used to deserialize an NBT tag from a `Buffer` object. | ||
- If the buffer already exists, the `NBTag.write_to(buffer, with_type=True, with_name=True)` method can be used to write the NBT tag to the buffer (and in that case with the type and name in the right format). | ||
- The `NBTag.read_from(buffer, with_type=True, with_name=True)` method can be used to read an NBT tag from the buffer (and in that case with the type and name in the right format). |
Oops, something went wrong.