From 1e8735328e2b149de761e1da59aa9e9438ae2283 Mon Sep 17 00:00:00 2001 From: Nicolas F Date: Thu, 4 Jul 2019 15:27:58 +0200 Subject: [PATCH] textures: try more than the most recent Minecraft We can try each jar in descending order of versions until we actually find one that works. This fixes #1328. Future work might move the "if self.jar is not None" higher up in the function so that we don't keep re-checking the overviewer dir and texture path for files that we will then not use at all for some reason. --- overviewer_core/textures.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/overviewer_core/textures.py b/overviewer_core/textures.py index 114afd1..160579f 100644 --- a/overviewer_core/textures.py +++ b/overviewer_core/textures.py @@ -276,7 +276,7 @@ class Textures(object): # method. versions = [] - most_recent_version = [0,0,0] + available_versions = [] for version in versions: # Look for the latest non-snapshot that is at least 1.8. This # version is only compatible with >=1.8, and we cannot in general @@ -294,11 +294,14 @@ class Textures(object): if versionparts < [1,8]: continue - if versionparts > most_recent_version: - most_recent_version = versionparts + available_versions.append(versionparts) - if most_recent_version != [0,0,0]: - if verbose: logging.info("Most recent version >=1.8.0: {0}. Searching it for the file...".format(most_recent_version)) + available_versions.sort(reverse=True) + if not available_versions: + if verbose: logging.info("Did not find any non-snapshot minecraft jars >=1.8.0") + while(available_versions): + most_recent_version = available_versions.pop(0) + if verbose: logging.info("Trying {0}. Searching it for the file...".format(".".join(str(x) for x in most_recent_version))) jarname = ".".join(str(x) for x in most_recent_version) jarpath = os.path.join(versiondir, jarname, jarname + ".jar") @@ -315,8 +318,6 @@ class Textures(object): pass if verbose: logging.info("Did not find file {0} in jar {1}".format(filename, jarpath)) - else: - if verbose: logging.info("Did not find any non-snapshot minecraft jars >=1.8.0") # Last ditch effort: look for the file is stored in with the overviewer # installation. We include a few files that aren't included with Minecraft