Skip to content

Commit

Permalink
- new fabric loader gets priority
Browse files Browse the repository at this point in the history
- fabric loader makes a new profile 'Minelabs' with picture
- new version for Dashboard link (more general)
  • Loading branch information
BertJorissen committed Nov 22, 2023
1 parent dec5342 commit e0c7be1
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 29 deletions.
2 changes: 1 addition & 1 deletion resources/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"dashboard-link": {
"alpha": "https://github.com/ScicraftLearn/Dashboard-Link/releases/download/v0.1.0/dashboard-link-1.0.0.jar",
"latest": "https://github.com/ScicraftLearn/Dashboard-Link/releases/download/v0.2.0/dashboard-link-0.2.0.jar"
"latest": "https://github.com/ScicraftLearn/Dashboard-Link/releases/download/v0.2.1/dashboard-link-0.2.1.jar"
}
},
"mod-extensions": {
Expand Down
6 changes: 4 additions & 2 deletions src/logic/fabric.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ def install_client(loader: str, game: str):
# minecraft not yet installed
os.makedirs(config.versionsdir)

profile_name = f"{config.loader_name}-{loader}-{game}"
#profile_name = f"{config.loader_name}-{loader}-{game}"
profile_name = "Minelabs"
profile_dir = os.path.join(config.versionsdir, profile_name)

if os.path.exists(profile_dir):
Expand All @@ -75,6 +76,7 @@ def install_client(loader: str, game: str):
return

with open(profile_json, "w") as json_file:
meta_json_loader_game["id"] = profile_name
json.dump(meta_json_loader_game, json_file)

with open(profile_jar, 'wb') as file:
Expand Down Expand Up @@ -123,7 +125,7 @@ def install_client(loader: str, game: str):
profile_data = json.load(json_file)
if 'profiles' not in profile_data:
profile_data['profiles'] = {}
profile_nam = f"Minelabs-{game}"
profile_nam = f"Minelabs"
if profile_nam not in profile_data["profiles"]:
profile_data["profiles"][profile_nam] = {
"name": profile_name,
Expand Down
53 changes: 27 additions & 26 deletions src/logic/installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,39 +112,40 @@ def run_installer(version, selected_mods, selected_maps, install_fabric=True):

yield "Downloading fabric...", round(steps_completed / number_of_steps * 100)

# Downloads the fabric installer and returns the path to the zip file
fabric_installer = downloader.download_fabric_installer(version, temp_folder)

if fabric_installer is None:
# deletes the installed content
utils.delete_files(installed_content)
utils.delete_temporary_folder(temp_folder)
raise Exception("Failed to download the fabric installer.")

steps_completed += 1

yield "Installing fabric...", round(steps_completed / number_of_steps * 100)

# installs fabric
successful, message = installer.install_fabric(fabric_installer, version)
from src.logic.fabric import install_client
successful = install_client("0.14.24", utils.get_minecraft_version(version))
message = "Success with Python" if successful is not None else "Not successfull with Python, doing java"

if successful:
steps_completed += 1
yield "Installing fabric...", round(steps_completed / number_of_steps * 100)
steps_completed += 1
yield message, round(steps_completed / number_of_steps * 100)

else:
from src.logic.fabric import install_client
successful = install_client("0.14.24", utils.get_minecraft_version(version))
message = "Success with Python"
# Downloads the fabric installer and returns the path to the zip file
fabric_installer = downloader.download_fabric_installer(version, temp_folder)

if fabric_installer is None:
# deletes the installed content
utils.delete_files(installed_content)
utils.delete_temporary_folder(temp_folder)
raise Exception("Failed to download the fabric installer.")

if successful:
steps_completed += 1
yield message, round(steps_completed / number_of_steps * 100)
else:
# deletes the installed content
utils.delete_files(installed_content)
utils.delete_temporary_folder(temp_folder)
raise Exception(message)

yield "Installing fabric...", round(steps_completed / number_of_steps * 100)

# installs fabric
successful, message = installer.install_fabric(fabric_installer, version)

if successful:
steps_completed += 1
yield message, round(steps_completed / number_of_steps * 100)
else:
# deletes the installed content
utils.delete_files(installed_content)
utils.delete_temporary_folder(temp_folder)
raise Exception(message)

# deletes the temporary folder
utils.delete_temporary_folder(temp_folder)
Expand Down

0 comments on commit e0c7be1

Please sign in to comment.