Skip to content

Commit

Permalink
Testing fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
The Judge committed Apr 12, 2024
1 parent 16090a8 commit 83e2522
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/java/pojlib/api/API_V1.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public static String getQCSupportedVersionName(MinecraftMeta.MinecraftVersion ve
* @param gameDir .minecraft directory.
* @return A minecraft instance object
*/
public static MinecraftInstances loadAll(String gameDir) {
public static MinecraftInstances loadAll(String gameDir) throws IOException {
return InstanceHandler.load(gameDir);
}

Expand Down
14 changes: 11 additions & 3 deletions src/main/java/pojlib/instance/InstanceHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
import pojlib.util.VLoader;

public class InstanceHandler {
public static final String MODS = "https://raw.githubusercontent.com/QuestCraftPlusPlus/Pojlib/QuestCraft/mods.json";
public static final String DEV_MODS = "https://raw.githubusercontent.com/QuestCraftPlusPlus/Pojlib/QuestCraft/devmods.json";
public static final String MODS = "https://raw.githubusercontent.com/QuestCraftPlusPlus/Pojlib/instance-refactor/mods.json";
public static final String DEV_MODS = "https://raw.githubusercontent.com/QuestCraftPlusPlus/Pojlib/instance-refactor/devmods.json";

public enum ModLoader {
Fabric(0),
Expand Down Expand Up @@ -121,7 +121,15 @@ public static MinecraftInstances.Instance create(Activity activity, String insta

// Load an instance from json
public static MinecraftInstances load(String gameDir) {
return GsonUtils.jsonFileToObject(gameDir + "/instances.json", MinecraftInstances.class);
MinecraftInstances instances;
try {
instances = GsonUtils.jsonFileToObject(gameDir + "/instances.json", MinecraftInstances.class);
} catch (Exception e) {
instances = new MinecraftInstances();
}
assert instances != null;

return instances;
}

public static void addMod(MinecraftInstances instances, MinecraftInstances.Instance instance,
Expand Down

0 comments on commit 83e2522

Please sign in to comment.