Skip to content

Commit

Permalink
Merge remote-tracking branch 'iris/master', release 1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Justsnoopy30 committed Nov 14, 2021
1 parent 6fd8d07 commit a29015d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
org.gradle.jvmargs=-Xmx1G

# Version and packaging info
version=1.2.5
version=1.3.0
maven_group=net.hypercubemc
archives_base_name=Universe-Installer

Expand Down
16 changes: 8 additions & 8 deletions src/main/java/net/hypercubemc/universe_installer/Installer.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package net.hypercubemc.universe_installer;

import com.formdev.flatlaf.FlatLightLaf;
import com.formdev.flatlaf.FlatDarkLaf;
import com.formdev.flatlaf.FlatLightLaf;
import net.fabricmc.installer.Main;
import net.fabricmc.installer.util.MetaHandler;
import net.fabricmc.installer.util.Reference;
Expand Down Expand Up @@ -239,9 +239,9 @@ public void start() {
String loaderName = useCustomLoader ? "universe-fabric-loader" : "fabric-loader";

try {
URL customLoaderVersionUrl = new URL("https://raw.githubusercontent.com/HyperCubeMC/Universe-Installer-Maven/master/latest-loader");
URL customLoaderVersionUrl = new URL(MAVEN_URL + "latest-loader");
String loaderVersion = useCustomLoader ? Utils.readTextFile(customLoaderVersionUrl) : Main.LOADER_META.getLatestVersion(false).getVersion();
boolean success = VanillaLauncherIntegration.installToLauncher(getVanillaGameDir(), getInstallDir(), useCustomLoader ? selectedEdition.displayName : "Fabric Loader " + selectedVersion, selectedVersion, loaderName, loaderVersion, useCustomLoader ? VanillaLauncherIntegration.Icon.UNIVERSE : VanillaLauncherIntegration.Icon.FABRIC);
boolean success = VanillaLauncherIntegration.installToLauncher(getVanillaGameDir(), getInstallDir(), useCustomLoader ? selectedEdition.displayName + " for " + selectedVersion : "Fabric Loader " + selectedVersion, selectedVersion, loaderName, loaderVersion, useCustomLoader ? VanillaLauncherIntegration.Icon.UNIVERSE : VanillaLauncherIntegration.Icon.FABRIC);
if (!success) {
System.out.println("Failed to install to launcher, canceling!");
return;
Expand Down Expand Up @@ -271,10 +271,10 @@ public void start() {
downloader.get();
} catch (InterruptedException | ExecutionException e) {
System.out.println("Failed to download zip!");
e.getCause().printStackTrace();
e.printStackTrace();

String msg = String.format("An error occurred while attempting to download the required files, please check your internet connection and try again! \nError: %s",
e.getCause().toString());
e);
JOptionPane.showMessageDialog(frame,
msg, "Download Failed!", JOptionPane.ERROR_MESSAGE, null);
readyAll();
Expand All @@ -287,7 +287,7 @@ public void start() {
File installDir = getInstallDir().toFile();
if (!installDir.exists() || !installDir.isDirectory()) installDir.mkdirs();

File modsFolder = getInstallDir().resolve(useCustomLoader ? "universe-reserved" : "mods").toFile();
File modsFolder = useCustomLoader ? getInstallDir().resolve("universe-reserved").resolve(selectedVersion).toFile() : getInstallDir().resolve("mods").toFile();
File[] modsFolderContents = modsFolder.listFiles();
if (modsFolderContents != null) {
boolean isEmpty = modsFolderContents.length == 0;
Expand All @@ -303,7 +303,7 @@ public void start() {
}

if (useCustomLoader) deleteDirectory(modsFolder);
if (!modsFolder.exists() || !modsFolder.isDirectory()) modsFolder.mkdir();
if (!modsFolder.exists() || !modsFolder.isDirectory()) modsFolder.mkdirs();

boolean installSuccess = installFromPack(getStorageDirectory().resolve("repo").resolve(selectedVersion).resolve(selectedEdition.name).toFile());
if (installSuccess) {
Expand Down Expand Up @@ -428,7 +428,7 @@ private void installFiles(File[] files) throws IOException {
String entryPath = getStorageDirectory().resolve("repo").resolve(selectedVersion).resolve(selectedEdition.name).relativize(entry.toPath()).toString();

if (config.shouldUseCustomLoader() && entryPath.startsWith("mods" + File.separator)) {
entryPath = entryPath.replace("mods" + File.separator, "universe-reserved" + File.separator);
entryPath = entryPath.replace("mods" + File.separator, "universe-reserved" + File.separator + selectedVersion + File.separator);
}

File filePath = getInstallDir().resolve(entryPath).toFile();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static boolean installToLauncher(Path vanillaGameDir, Path instanceDir, S
}

public static void installVersion(Path mcDir, String gameVersion, String loaderName, String loaderVersion, ProfileInstaller.LauncherType launcherType) throws IOException {
System.out.println("Installing " + gameVersion + " with fabric " + loaderVersion + " to launcher " + launcherType);
System.out.println("Installing " + gameVersion + " with loader " + loaderVersion + " to launcher " + launcherType);
String versionId = String.format("%s-%s-%s", loaderName, loaderVersion, gameVersion);
Path versionsDir = mcDir.resolve("versions");
Path profileDir = versionsDir.resolve(versionId);
Expand All @@ -49,7 +49,7 @@ public static void installVersion(Path mcDir, String gameVersion, String loaderN
}
Utils.writeToFile(profileJsonPath, profileJson.toString());
}

private static void editVersionJson(Json profileJson) {
Json.Factory factory = Json.factory();
Map<String, Json> json = profileJson.asJsonMap();
Expand Down

0 comments on commit a29015d

Please sign in to comment.