diff --git a/map_extractor/extractor.py b/map_extractor/extractor.py index 6e1b0e3..d47e354 100644 --- a/map_extractor/extractor.py +++ b/map_extractor/extractor.py @@ -1,8 +1,8 @@ from io import BytesIO -from nbtlib import Compound from PIL import Image import numpy as np +import amulet_nbt __all__ = ( @@ -19,14 +19,14 @@ def iter_colors_from_world(world): if not key.startswith(b"map_"): continue - compound = Compound.parse(BytesIO(value), "little")[""] + compound = amulet_nbt.load(value, compressed=False, little_endian=True) colors = compound["colors"] if len(set(colors)) <= 1: continue - yield compound["mapId"].unpack(), colors + yield compound["mapId"].value, colors def generate_map_image(colors): - array = np.uint8(np.fromiter(colors, int)) + array = np.fromiter(colors, np.uint8) image = array.reshape((MAP_WIDTH, MAP_HEIGHT, 4)) return Image.fromarray(image) diff --git a/setup.py b/setup.py index a127445..60207dc 100644 --- a/setup.py +++ b/setup.py @@ -2,10 +2,10 @@ setup( name="map-extractor", - version="1.1.0", + version="1.2.0", install_requires=[ "Pillow>=9.0.1,<9.1.0", - "nbtlib>=2.0.4,<2.1.0", + "amulet-nbt>=1.0.3.10,<1.1.0.0", "tqdm>=4.62.3,<4.63.0" ], extras_require={