Skip to content

Commit

Permalink
Launchers Detection WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Aspirata committed Jul 4, 2024
1 parent 38b7e75 commit 1ec73b7
Show file tree
Hide file tree
Showing 3,142 changed files with 53 additions and 815 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 4 additions & 0 deletions Mcblend Source/Data.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,10 @@

}

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

# Materials Categories

Backface_Culling_Materials = ["glass", "door", "nether_portal"]
Expand Down
26 changes: 23 additions & 3 deletions Mcblend Source/MCB_API.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from .Data import *
from .Assets import update_assets
from distutils.version import LooseVersion

def InitOnStart():

Expand Down Expand Up @@ -130,9 +131,28 @@ def set_resource_packs(resource_packs, debug=None):
def update_default_pack(debug=None):
resource_packs = bpy.context.scene["resource_packs"]

default_pack = "Minecraft 1.20.6"
default_path = os.path.join(resource_packs_directory, default_pack)
resource_packs[default_pack] = {"path": (default_path), "type": "Texture", "enabled": True}
def find_mc():
versions = {}
for launcher, path in Launchers.items():
folders = os.listdir(os.path.join(os.getenv('APPDATA'), path))
for folder in folders:
version = folder.split("-")[0]
if not any(char.isalpha() for char in version):
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")
else:
return None, None

MC = find_mc()
if MC != (None, None):
version, path = MC
default_pack = f"Minecraft {version}"
default_path = os.path.join(resource_packs_directory, default_pack)
resource_packs[default_pack] = {"path": (path), "type": "Texture", "enabled": True}

default_pack = "Bare Bones 1.20.6"
default_path = os.path.join(resource_packs_directory, default_pack)
Expand Down
10 changes: 10 additions & 0 deletions Mcblend Source/Materials/Materials.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,16 @@ def find_image(image_name, root_folder):
extract_path = os.path.join(main_directory, 'Resource Packs', os.path.splitext(file)[0])
extracted_file_path = zip_ref.extract(image_name, extract_path)
return extracted_file_path
elif "grass" in image_name:
if "short_" + image_name in file_list:
extract_path = os.path.join(main_directory, 'Resource Packs', os.path.splitext(file)[0])
extracted_file_path = zip_ref.extract("short_" + image_name, extract_path)
return extracted_file_path

if image_name.replace("short_", "") in file_list:
extract_path = os.path.join(main_directory, 'Resource Packs', os.path.splitext(file)[0])
extracted_file_path = zip_ref.extract(image_name.replace("short_", ""), extract_path)
return extracted_file_path

if "grass" in image_name:
if os.path.isfile(format_fixed := os.path.join(dirpath, "short_" + image_name)):
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.

This file was deleted.

Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.

This file was deleted.

Diff not rendered.
Diff not rendered.

This file was deleted.

Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.

This file was deleted.

Diff not rendered.

This file was deleted.

Diff not rendered.

This file was deleted.

Diff not rendered.

This file was deleted.

Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.

This file was deleted.

Diff not rendered.

This file was deleted.

Diff not rendered.

This file was deleted.

Diff not rendered.

This file was deleted.

Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.

This file was deleted.

Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Loading

0 comments on commit 1ec73b7

Please sign in to comment.