Skip to content

Commit

Permalink
Added support for old and new nbt versions
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlegiantJGC committed Sep 17, 2024
1 parent ee65d76 commit 9d70c60
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion minecraft_model_reader/api/amulet/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
import re
from typing import Iterable, Union, Optional, Any
import amulet_nbt
if amulet_nbt.__major__ >= 4:
from amulet_nbt import read_snbt # type: ignore
else:
from amulet_nbt import from_snbt as read_snbt # type: ignore

PropertyValueType = Union[
amulet_nbt.TAG_Byte,
Expand Down Expand Up @@ -302,7 +306,7 @@ def parse_blockstate_string(

if snbt:
properties_dict = {
k: amulet_nbt.from_snbt(v) for k, v in sorted(properties.items())
k: read_snbt(v) for k, v in sorted(properties.items())
}
else:
properties_dict = {
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ python_requires = ~=3.9
install_requires =
Pillow>=10.0.1
numpy>=1.17
amulet-nbt~=2.0
amulet-nbt >= 2.0, < 5.0
platformdirs~=3.1
[options.packages.find]
Expand Down

0 comments on commit 9d70c60

Please sign in to comment.