def is_valid(directory): """ Returns whether this format is able to load a given world. :param directory: The path to the root of the world to load. :return: True if the world can be loaded by this format, False otherwise. """ return check_all_exist(directory, "db", "level.dat", "levelname.txt")
def is_valid(path: str) -> bool: if not check_all_exist(path, "level.dat"): return False try: level_dat_root = load_leveldat(path) assert isinstance(level_dat_root.value, TAG_Compound) except: return False if "Data" not in level_dat_root: return False if "FML" in level_dat_root: return False return True
def is_valid(directory) -> bool: """ Returns whether this format is able to load a given world. :param directory: The path to the root of the world to load. :return: True if the world can be loaded by this format, False otherwise. """ if not check_all_exist(directory, "level.dat"): return False try: level_dat_root = load_leveldat(directory) except: return False if "Data" not in level_dat_root: return False if "FML" in level_dat_root: return False return True
def is_valid(path: str): return check_all_exist(path, "db", "level.dat", "levelname.txt")