From f49dafd40be8d266b7c301d56af1713be06067df Mon Sep 17 00:00:00 2001 From: lapis256 <45414333+Lapis256@users.noreply.github.com> Date: Tue, 8 Feb 2022 23:59:19 +0900 Subject: [PATCH] =?UTF-8?q?nbtlib=E3=81=8B=E3=82=89amulet-nbt=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- map_extractor/extractor.py | 8 ++++---- setup.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) 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={