diff --git a/amulet/api/wrapper/format_wrapper.py b/amulet/api/wrapper/format_wrapper.py index 7a20e7bc2..94d4e91b5 100644 --- a/amulet/api/wrapper/format_wrapper.py +++ b/amulet/api/wrapper/format_wrapper.py @@ -232,7 +232,7 @@ def bounds(self, dimension: Dimension) -> SelectionGroup: if dimension not in self._bounds: if dimension in self.dimensions: raise Exception( - f'The dimension exists but there is not selection registered for it. Please report this to a developer "{dimension}" {self}' + f'The dimension exists but there is no selection registered for it. Please report this to a developer "{dimension}" {self}' ) else: raise DimensionDoesNotExist diff --git a/amulet/level/formats/anvil_forge_world.py b/amulet/level/formats/anvil_forge_world.py index bf3a77d4c..e06141a40 100644 --- a/amulet/level/formats/anvil_forge_world.py +++ b/amulet/level/formats/anvil_forge_world.py @@ -1,4 +1,5 @@ from __future__ import annotations +import glob import os from amulet_nbt import load as load_nbt @@ -24,7 +25,9 @@ def is_valid(path: str) -> bool: except: return False - return "Data" in level_dat_root and "FML" in level_dat_root + return "Data" in level_dat_root and ( + "FML" in level_dat_root or "fml" in level_dat_root + ) @property def game_version_string(self) -> str: diff --git a/amulet/level/formats/anvil_world/format.py b/amulet/level/formats/anvil_world/format.py index 3dc950cb5..26587b4ce 100644 --- a/amulet/level/formats/anvil_world/format.py +++ b/amulet/level/formats/anvil_world/format.py @@ -412,15 +412,20 @@ def _reload_world(self): continue self._register_dimension(dir_name) - for dimension_path in glob.glob( - os.path.join(glob.escape(self.path), "dimensions", "*", "*", "region") + for region_path in glob.glob( + os.path.join( + glob.escape(self.path), "dimensions", "*", "*", "**", "region" + ), + recursive=True, ): - dimension_path_split = dimension_path.split(os.sep) - dimension_name = f"{dimension_path_split[-3]}:{dimension_path_split[-2]}" - self._register_dimension( - os.path.dirname(os.path.relpath(dimension_path, self.path)), - dimension_name, - ) + if not os.path.isdir(region_path): + continue + dimension_path = os.path.dirname(region_path) + rel_dim_path = os.path.relpath(dimension_path, self.path) + _, dimension, *base_name = rel_dim_path.split(os.sep) + + dimension_name = f"{dimension}:{'/'.join(base_name)}" + self._register_dimension(rel_dim_path, dimension_name) def _open(self): """Open the database for reading and writing"""