Skip to content

Commit

Permalink
Fix Meta Skill Issue | Update Parser
Browse files Browse the repository at this point in the history
  • Loading branch information
CADIndie committed Apr 10, 2024
1 parent e250688 commit 004ee76
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 15 deletions.
6 changes: 4 additions & 2 deletions src/main/java/pojlib/account/MinecraftAccount.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import static pojlib.account.Msa.checkMcProfile;

import android.app.Activity;

import com.google.gson.Gson;

import org.json.JSONException;
Expand Down Expand Up @@ -33,8 +35,8 @@ public static MinecraftAccount login(String gameDir, String[] response) throws I
return account;
}

public static boolean logout(String path) {
File accountFile = new File(path + "/account.json");
public static boolean logout(Activity activity) {
File accountFile = new File(activity.getFilesDir() + "/account.json");
return accountFile.delete();
}

Expand Down
8 changes: 5 additions & 3 deletions src/main/java/pojlib/api/API_V1.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public class API_V1 {
public static String memoryValue = "1800";
public static boolean developerMods;
public static MinecraftAccount currentAcc;

public static boolean advancedDebugger;


Expand Down Expand Up @@ -126,11 +127,11 @@ public static void launchInstance(Activity activity, MinecraftAccount account, M
/**
* Logs the user out
*
* @param home The base directory where minecraft should be setup
* @param activity The base directory where minecraft should be setup
* @return True if logout was successful
*/
public static boolean logout(String home) {
return MinecraftAccount.logout(home);
public static boolean logout(Activity activity) {
return MinecraftAccount.logout(activity);
}

public static void login(Activity activity)
Expand Down Expand Up @@ -159,6 +160,7 @@ public static void login(Activity activity)
API_V1.profileName = API_V1.currentAcc.username;
}
}

LoginHelper.beginLogin(activity);
}
}
12 changes: 6 additions & 6 deletions src/main/java/pojlib/instance/MinecraftInstance.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public void updateOrDownloadMods() {
if(customMods.exists()) {
assert customModsObj != null;
for(CustomMods.InstanceMods instMods : customModsObj.instances) {
if(!instMods.version.equals(this.versionName)) {
if(!instMods.name.equals(this.versionName)) {
continue;
}
for(CustomMods.ModInfo info : instMods.mods) {
Expand Down Expand Up @@ -249,7 +249,7 @@ public void addCustomMod(String name, String version, String url) {
CustomMods mods = new CustomMods();
mods.instances = new CustomMods.InstanceMods[1];
mods.instances[0] = new CustomMods.InstanceMods();
mods.instances[0].version = this.versionName;
mods.instances[0].name = this.versionName;
mods.instances[0].mods = new CustomMods.ModInfo[1];
mods.instances[0].mods[0] = new CustomMods.ModInfo();
mods.instances[0].mods[0].name = name;
Expand All @@ -262,7 +262,7 @@ public void addCustomMod(String name, String version, String url) {

CustomMods mods = GsonUtils.jsonFileToObject(customMods.getPath(), CustomMods.class);
for(CustomMods.InstanceMods instance : mods.instances) {
if(instance.version.equals(this.versionName)) {
if(instance.name.equals(this.versionName)) {
ArrayList<CustomMods.ModInfo> modInfoArray = new ArrayList<>(Arrays.asList(instance.mods));
CustomMods.ModInfo info = new CustomMods.ModInfo();
info.name = name;
Expand All @@ -282,7 +282,7 @@ public void addCustomMod(String name, String version, String url) {
// If instance does not exist in file, create it
ArrayList<CustomMods.InstanceMods> instanceInfo = new ArrayList<>(Arrays.asList(mods.instances));
CustomMods.InstanceMods instMods = new CustomMods.InstanceMods();
instMods.version = this.versionName;
instMods.name = this.versionName;
instMods.mods = new CustomMods.ModInfo[1];
instMods.mods[0] = new CustomMods.ModInfo();
instMods.mods[0].name = name;
Expand All @@ -304,7 +304,7 @@ public boolean hasCustomMod(String name) throws IOException {
CustomMods mods = GsonUtils.jsonFileToObject(customMods.getPath(), CustomMods.class);
assert mods != null;
for(CustomMods.InstanceMods instance : mods.instances) {
if(instance.version.equals(this.versionName)) {
if(instance.name.equals(this.versionName)) {
for (CustomMods.ModInfo info : instance.mods) {
// Check if core mod is already included
File modsOld = new File(Constants.USER_HOME + "/mods.json");
Expand Down Expand Up @@ -355,7 +355,7 @@ public boolean removeMod(String name) {
CustomMods mods = GsonUtils.jsonFileToObject(customMods.getAbsolutePath(), CustomMods.class);
assert mods != null;
for(CustomMods.InstanceMods instance : mods.instances) {
if(instance.version.equals(this.versionName)) {
if(instance.name.equals(this.versionName)) {
for (CustomMods.ModInfo info : instance.mods) {
if(info.name.equals(name)) {
ArrayList<CustomMods.ModInfo> modInfoArray = new ArrayList<>(Arrays.asList(instance.mods));
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/pojlib/util/CoreMods.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package pojlib.util;

import java.util.List;

public class CoreMods {
public Version[] versions;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/pojlib/util/CustomMods.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public class CustomMods {
public InstanceMods[] instances;

public static class InstanceMods {
public String version;
public String name;
public ModInfo[] mods;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/pojlib/util/JREUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public static int launchJavaVM(final Activity activity, final List<String> JVMAr
userArgs.add("-Xms" + API_V1.memoryValue + "M");
userArgs.add("-Xmx" + API_V1.memoryValue + "M");
} else {
if (API_V1.model.equals("Meta Quest Pro")) {
if (API_V1.model.equals("Meta Quest Pro") || API_V1.model.equals("Oculus Headset1")) {
userArgs.add("-Xms" + 4096 + "M");
userArgs.add("-Xmx" + 4096 + "M");
} else {
Expand Down

0 comments on commit 004ee76

Please sign in to comment.