mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-08-19 05:24:11 +02:00
Fixed find_highest_minecraft_version, got rid of hardcoded major-minor version string.
This commit is contained in:
parent
1147a9715a
commit
0584fc4ebf
@ -1,4 +1,5 @@
|
|||||||
import shutil, csv, os, tempfile, sys, argparse, glob, re, zipfile
|
import shutil, csv, os, tempfile, sys, argparse, glob, re, zipfile
|
||||||
|
from .config import SUPPORTED_MINECRAFT_VERSION
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
|
|
||||||
@ -27,8 +28,8 @@ def colorize_alpha(colormap, source, colormap_pixel, texture_size, destination,
|
|||||||
colorize(colormap, source, colormap_pixel, texture_size, destination, tempfile2_name)
|
colorize(colormap, source, colormap_pixel, texture_size, destination, tempfile2_name)
|
||||||
os.system("composite -compose Dst_In "+source+" "+tempfile2_name+" -alpha Set "+destination)
|
os.system("composite -compose Dst_In "+source+" "+tempfile2_name+" -alpha Set "+destination)
|
||||||
|
|
||||||
def find_highest_minecraft_version(home):
|
def find_highest_minecraft_version(home, supported_version):
|
||||||
version_pattern = re.compile(r"1\.20\.\d+")
|
version_pattern = re.compile(re.escape(supported_version) + r"\.\d+")
|
||||||
versions_dir = os.path.join(home, ".minecraft", "versions")
|
versions_dir = os.path.join(home, ".minecraft", "versions")
|
||||||
highest_version = None
|
highest_version = None
|
||||||
if os.path.isdir(versions_dir):
|
if os.path.isdir(versions_dir):
|
||||||
@ -39,7 +40,7 @@ def find_highest_minecraft_version(home):
|
|||||||
return highest_version
|
return highest_version
|
||||||
|
|
||||||
def handle_default_minecraft_texture(home, output_dir):
|
def handle_default_minecraft_texture(home, output_dir):
|
||||||
version = find_highest_minecraft_version(home)
|
version = find_highest_minecraft_version(home, SUPPORTED_MINECRAFT_VERSION)
|
||||||
if not version:
|
if not version:
|
||||||
print("No suitable Minecraft version found.")
|
print("No suitable Minecraft version found.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user