diff --git a/minecraft_model_reader/api/resource_pack/java/resource_pack_manager.py b/minecraft_model_reader/api/resource_pack/java/resource_pack_manager.py index 2d213e4..8fc6435 100644 --- a/minecraft_model_reader/api/resource_pack/java/resource_pack_manager.py +++ b/minecraft_model_reader/api/resource_pack/java/resource_pack_manager.py @@ -186,14 +186,14 @@ def _load_iter(self) -> Iterator[float]: try: self._blockstate_files[key] = json.load(fi) except json.JSONDecodeError: - log.error(f"Failed to parse blockstate file {path}") + log.exception(f"Failed to parse blockstate file {path}") for key, path in model_file_paths.items(): with open(path) as fi: try: self._model_files[key] = json.load(fi) except json.JSONDecodeError: - log.error(f"Failed to parse model file file {path}") + log.exception(f"Failed to parse model file file {path}") @property def textures(self) -> tuple[str, ...]: @@ -236,8 +236,8 @@ def _get_model(self, block: Block) -> BlockMesh: blockstate["variants"][variant] ) except Exception as e: - log.error( - f"Failed to load block model {blockstate['variants'][variant]}\n{e}" + log.exception( + f"Failed to load block model {blockstate['variants'][variant]}" ) else: properties_match = Block.properties_regex.finditer( @@ -256,8 +256,8 @@ def _get_model(self, block: Block) -> BlockMesh: blockstate["variants"][variant] ) except Exception as e: - log.error( - f"Failed to load block model {blockstate['variants'][variant]}\n{e}" + log.exception( + f"Failed to load block model {blockstate['variants'][variant]}" ) elif "multipart" in blockstate: @@ -300,11 +300,11 @@ def _get_model(self, block: Block) -> BlockMesh: ) except Exception as e: - log.error( - f"Failed to load block model {case['apply']}\n{e}" + log.exception( + f"Failed to load block model {case['apply']}" ) except Exception as e: - log.error(f"Failed to parse block state for {block}\n{e}") + log.exception(f"Failed to parse block state for {block}") return BlockMesh.merge(models) @@ -411,6 +411,8 @@ def _load_block_model(self, model_path: str) -> BlockMesh: texture_relative_path = java_model["textures"].get( texture_relative_path[1:], None ) + if isinstance(texture_relative_path, dict): + texture_relative_path = texture_relative_path["sprite"] texture_path_list = texture_relative_path.split(":", 1) if len(texture_path_list) == 2: namespace, texture_relative_path = texture_path_list