Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep NBT-reading functionality when upgrading to newer nbtlib #11

Closed
MestreLion opened this issue Jul 12, 2023 · 1 comment
Closed

Keep NBT-reading functionality when upgrading to newer nbtlib #11

MestreLion opened this issue Jul 12, 2023 · 1 comment

Comments

@MestreLion
Copy link
Owner

MestreLion commented Jul 12, 2023

As a consequence of many important re-structuring in nbtlib, specially in the 2.x series, some backward-compatibility was lost and at its current state it can't read some .dat files it used to.

Meanwhile, mcworldlib is still stuck with an older 1.6.3 nbtlib, as it was the last version to support Python 3.6 which is still supported by mcworldlib.

This issue was created to track down this versioning and dependencies issues: bump up the minimum Python requirement to 3.7 (or skip directly to 3.8), so we can bump up the maximum compatible nbtlib as high as possible while still avoiding any NBT-reading breaking changes.

Case in point: mcworldlib must be able to handle this test file without any issues, as requested by @Netherwhal in vberlier/nbtlib#145:

$ git clone https://github.com/MestreLion/mcworldlib
$ cd mcworldib
$ pip3 install -e .
$ python3
>>> import mcworldlib as mc
>>> data = mc.nbt.load_dat('data/6d26bff4.dat')
>>> mc.nbt_explorer(data)
⊟ abilities: 7 entries
├─── flying: 0b
├─── flySpeed: 0.05000000074505806f
├─── instabuild: 0b
├─── invulnerable: 0b
├─── mayBuild: 1b
├─── mayfly: 0b
╰─── walkSpeed: 0.10000000149011612fBrain: 1 entry
╰──⊞ memories: 0 entriesbukkit: 8 entries
├─── expToDrop: 0
...
MestreLion added a commit that referenced this issue Jul 12, 2023
@MestreLion
Copy link
Owner Author

There you go! Bug fixed, nbtlib upgraded to latest (2.0.4), and finally uploaded to pypy!

(venv) 02:48:29 mestrelion@desktop ~/test $ pip install mcworldlib
Collecting mcworldlib
  Using cached mcworldlib-2023.7.13-py3-none-any.whl (46 kB)
Collecting nbtlib>=2.0.4 (from mcworldlib)
  Using cached nbtlib-2.0.4-py3-none-any.whl (28 kB)
Collecting numpy (from mcworldlib)
  Using cached numpy-1.24.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.3 MB)
Collecting tqdm (from mcworldlib)
  Using cached tqdm-4.65.0-py3-none-any.whl (77 kB)
Installing collected packages: tqdm, numpy, nbtlib, mcworldlib
Successfully installed mcworldlib-2023.7.13 nbtlib-2.0.4 numpy-1.24.4 tqdm-4.65.0

(venv) 02:48:51 mestrelion@desktop ~/test $ python
Python 3.8.0 (default, Feb 28 2023, 16:22:29) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mcworldlib as mc
>>> data = mc.load_dat('6d26bff4.dat')
>>> data
<File '6d26bff4.dat' tags: 55>
>>> data.keys()
dict_keys(['Bukkit.updateLevel', 'foodTickTimer', ... ])
>>> mc.nbt_explorer(data)
⊟ abilities: 7 entries
├─── flying: Byte(0)
├─── flySpeed: Float(0.05000000074505806)
├─── instabuild: Byte(0)
├─── invulnerable: Byte(0)
├─── mayBuild: Byte(1)
├─── mayfly: Byte(0)
╰─── walkSpeed: Float(0.10000000149011612)
⊟ Brain: 1 entry
╰──⊞ memories: 0 entries
⊟ bukkit: 8 entries
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant