Skip to content

Commit

Permalink
Mojang launcher compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Aspirata committed Jul 12, 2024
1 parent 9a03b98 commit c4a7f76
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions Mcblend Source/Resource_Packs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ def set_resource_packs(resource_packs, debug=None):
print(f"Resource Packs: {bpy.context.scene['resource_packs']}")

Launchers = {
"Modrinth": "com.modrinth.theseus\\meta\\versions"
"Mojang": ".minecraft\\versions",
"Modrinth": "com.modrinth.theseus\\meta\\versions",
}

def update_default_pack():
Expand All @@ -35,23 +36,18 @@ def find_mc():
for folder in os.listdir(folders):
if version := version_formatter(folder):
versions[version] = (folder, os.path.join(os.getenv('APPDATA'), path))

if versions:
latest_version = max(versions, key=lambda x: LooseVersion(x))
latest_file, latest_path = versions[latest_version]
return latest_version, os.path.join(latest_path, latest_file, f"{latest_file}.jar")

elif Preferences.mc_instances_path:
if Preferences.mc_instances_path:
folders = Preferences.mc_instances_path
if os.path.isdir(folders):
for folder in os.listdir(folders):
if version := version_formatter(folder):
versions[version] = (folder, Preferences.mc_instances_path)
if versions:
latest_version = max(versions, key=lambda x: LooseVersion(x))
latest_file, latest_path = versions[latest_version]
return latest_version, os.path.join(latest_path, latest_file, f"{latest_file}.jar")

if versions:
latest_version = max(versions, key=lambda x: LooseVersion(x))
latest_file, latest_path = versions[latest_version]
return latest_version, os.path.join(latest_path, latest_file, f"{latest_file}.jar")

return None, None

Expand Down

0 comments on commit c4a7f76

Please sign in to comment.