Cleanup unused files
~~also fix a bit of grammar :trollface:~~
This commit is contained in:
1 parent
d533bfbb10
commit
96ea5fd687
9 files changed
+1
-275
No files matched your search
@@ -94,7 +94,7 @@ public class PLaunchApp {
|
||||
if (AccountJNI.CURRENT_ACCOUNT.accessToken.equals("0")) {
|
||||
if (!new File(verJsonDir).exists()) {
|
||||
// Local account: disallow install new version
|
||||
UIKit.showError("Error", "Minecraft couldn't be legally installed when logged in with a local account. Please switch to an online account to continue.", false);
|
||||
UIKit.showError("Error", "Minecraft can't be legally installed when logged in with a local account. Please switch to an online account to continue.", false);
|
||||
return;
|
||||
} else {
|
||||
// Local account: jump to launch Minecraft, not download anything
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
package net.kdt.pojavlaunch;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.shape.Circle;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class PLaunchJFXApp extends Application {
|
||||
public void start(Stage stage) {
|
||||
/*
|
||||
Circle circ = new Circle(40, 40, 30);
|
||||
Group root = new Group(circ);
|
||||
Scene scene = new Scene(root, 400, 300);
|
||||
stage.setTitle("JavaFX Application");
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
*/
|
||||
System.setProperty("os.name", "Mac OS X");
|
||||
|
||||
PLaunchApp.launchMinecraft();
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package net.kdt.pojavlaunch.installers;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.zip.*;
|
||||
import net.kdt.pojavlaunch.*;
|
||||
|
||||
public class BaseInstaller {
|
||||
protected File mFile;
|
||||
protected ZipFile mJarFile;
|
||||
|
||||
public void setInput(File file) throws IOException {
|
||||
mFile = file;
|
||||
mJarFile = new ZipFile(file);
|
||||
}
|
||||
|
||||
public int install(JavaGUILauncherActivity ctx) throws IOException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void from(BaseInstaller base) {
|
||||
mFile = base.mFile;
|
||||
mJarFile = base.mJarFile;
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package net.kdt.pojavlaunch.installers;
|
||||
|
||||
import android.content.*;
|
||||
import java.io.*;
|
||||
import java.util.jar.*;
|
||||
import net.kdt.pojavlaunch.*;
|
||||
import java.nio.charset.*;
|
||||
import net.kdt.pojavlaunch.value.*;
|
||||
import org.apache.commons.io.*;
|
||||
import com.google.gson.*;
|
||||
import java.util.zip.*;
|
||||
|
||||
public class FabricInstaller extends BaseInstaller {
|
||||
public FabricInstaller(BaseInstaller i) {
|
||||
from(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int install(JavaGUILauncherActivity ctx) throws IOException {
|
||||
// Unused ZipFile
|
||||
mJarFile.close();
|
||||
|
||||
String mcversion = ctx.dialogInput("Fabric installer", R.string.main_version);
|
||||
|
||||
ctx.appendlnToLog("Launching JVM");
|
||||
return ctx.launchJavaRuntime(null,
|
||||
"-jar " + mFile.getAbsolutePath() + " client -dir . -mcversion " + mcversion);
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package net.kdt.pojavlaunch.installers;
|
||||
|
||||
import java.io.*;
|
||||
import com.google.gson.*;
|
||||
import net.kdt.pojavlaunch.value.*;
|
||||
|
||||
public class InstallerDetector
|
||||
{
|
||||
public static boolean isFabric(BaseInstaller installer) {
|
||||
return installer.mJarFile.getEntry("net/fabricmc/installer/Main.class") != null;
|
||||
}
|
||||
|
||||
// Forge Legacy: for 1.12.1 and below
|
||||
public static boolean isForgeLegacy(BaseInstaller installer) throws IOException, JsonSyntaxException {
|
||||
ForgeInstallProfile profile = LegacyForgeInstaller.readInstallProfile(installer);
|
||||
return profile != null && profile.versionInfo != null;
|
||||
}
|
||||
|
||||
// Forge for 1.12.2 only
|
||||
public static boolean isForge1p12p2(BaseInstaller installer) throws IOException, JsonSyntaxException {
|
||||
ForgeInstallProfile profile = LegacyForgeInstaller.readInstallProfile(installer);
|
||||
// Forge 1.12.2 install_profile.json has same format as Forge 1.13+
|
||||
return isForgeNew(installer) && profile.minecraft.equals("1.12.2");
|
||||
}
|
||||
|
||||
// Forge New: for 1.13 and above
|
||||
public static boolean isForgeNew(BaseInstaller installer) throws IOException, JsonSyntaxException {
|
||||
ForgeInstallProfile profile = LegacyForgeInstaller.readInstallProfile(installer);
|
||||
return profile != null && profile.version != null;
|
||||
}
|
||||
}
|
||||
-60
@@ -1,60 +0,0 @@
|
||||
package net.kdt.pojavlaunch.installers;
|
||||
|
||||
import android.content.*;
|
||||
import java.io.*;
|
||||
import java.util.jar.*;
|
||||
import net.kdt.pojavlaunch.*;
|
||||
import java.nio.charset.*;
|
||||
import net.kdt.pojavlaunch.value.*;
|
||||
import org.apache.commons.io.*;
|
||||
import com.google.gson.*;
|
||||
import java.util.zip.*;
|
||||
|
||||
public class Legacy1p12p2ForgeInstaller extends BaseInstaller {
|
||||
public Legacy1p12p2ForgeInstaller(BaseInstaller i) {
|
||||
from(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int install(JavaGUILauncherActivity ctx) throws IOException {
|
||||
String target;
|
||||
|
||||
ctx.appendlnToLog("Reading install_profile.json");
|
||||
ForgeInstallProfile profile = readInstallProfile(this);
|
||||
|
||||
// Write the json file
|
||||
File versionFile = new File(Tools.DIR_HOME_VERSION, profile.version);
|
||||
versionFile.mkdir();
|
||||
target = versionFile.getAbsolutePath() + "/" + profile.version + ".json";
|
||||
ctx.appendlnToLog("Writing " + target + " from " + profile.json);
|
||||
ZipEntry versionJson = mJarFile.getEntry(profile.json==null ? "version.json" : profile.json.substring(profile.json.indexOf("/")+1,profile.json.length()));
|
||||
Tools.write(
|
||||
target,
|
||||
Tools.convertStream(mJarFile.getInputStream(versionJson))
|
||||
);
|
||||
|
||||
// Forge 1.12.2+ installer does not include universal, so download
|
||||
// Users are already go throught Forge ads to download installer, so not again.
|
||||
String[] libInfos = profile.path.split(":");
|
||||
File libraryFile = new File(Tools.DIR_HOME_LIBRARY, Tools.artifactToPath(libInfos[0], libInfos[1], libInfos[2]));
|
||||
libraryFile.getParentFile().mkdirs();
|
||||
target = libraryFile.getAbsolutePath();
|
||||
String downloadPath = "https://files.minecraftforge.net/maven/" + profile.path.replace(":", "/").replace("net.minecraftforge","net/minecraftforge") + "/forge-" + libInfos[2] + "-universal.jar";
|
||||
ctx.appendlnToLog("Downloading " + target);
|
||||
Tools.downloadFile(downloadPath, target);
|
||||
|
||||
mJarFile.close();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static ForgeInstallProfile readInstallProfile(BaseInstaller base) throws IOException, JsonSyntaxException {
|
||||
ZipEntry entry = base.mJarFile.getEntry("install_profile.json");
|
||||
return entry == null ? null : Tools.GLOBAL_GSON.fromJson(
|
||||
Tools.convertStream(
|
||||
base.mJarFile.getInputStream(entry)
|
||||
),
|
||||
ForgeInstallProfile.class
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package net.kdt.pojavlaunch.installers;
|
||||
import android.content.*;
|
||||
import java.io.*;
|
||||
import java.util.jar.*;
|
||||
import net.kdt.pojavlaunch.*;
|
||||
import java.nio.charset.*;
|
||||
import net.kdt.pojavlaunch.value.*;
|
||||
import org.apache.commons.io.*;
|
||||
import com.google.gson.*;
|
||||
import java.util.zip.*;
|
||||
|
||||
public class LegacyForgeInstaller extends BaseInstaller {
|
||||
public LegacyForgeInstaller(BaseInstaller i) {
|
||||
from(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int install(JavaGUILauncherActivity ctx) throws IOException {
|
||||
String target;
|
||||
|
||||
ctx.appendlnToLog("Reading install_profile.json");
|
||||
ForgeInstallProfile profile = readInstallProfile(this);
|
||||
|
||||
// Write the json file
|
||||
File versionFile = new File(Tools.DIR_HOME_VERSION, profile.install.target);
|
||||
versionFile.mkdir();
|
||||
target = versionFile.getAbsolutePath() + "/" + profile.install.target + ".json";
|
||||
ctx.appendlnToLog("Writing " + target);
|
||||
Tools.write(
|
||||
target,
|
||||
Tools.GLOBAL_GSON.toJson(profile.versionInfo)
|
||||
);
|
||||
|
||||
// Extract Forge universal
|
||||
String[] libInfos = profile.install.path.split(":");
|
||||
File libraryFile = new File(Tools.DIR_HOME_LIBRARY, Tools.artifactToPath(libInfos[0], libInfos[1], libInfos[2]));
|
||||
libraryFile.getParentFile().mkdirs();
|
||||
target = libraryFile.getAbsolutePath().replace("-universal", "");
|
||||
ctx.appendlnToLog("Writing " + target);
|
||||
InputStream in = mJarFile.getInputStream(mJarFile.getEntry(profile.install.filePath));
|
||||
FileOutputStream out = new FileOutputStream(target);
|
||||
IOUtils.copy(in, out);
|
||||
in.close();
|
||||
out.close();
|
||||
|
||||
mJarFile.close();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static ForgeInstallProfile readInstallProfile(BaseInstaller base) throws IOException, JsonSyntaxException {
|
||||
ZipEntry entry = base.mJarFile.getEntry("install_profile.json");
|
||||
return entry == null ? null : Tools.GLOBAL_GSON.fromJson(
|
||||
Tools.convertStream(
|
||||
base.mJarFile.getInputStream(entry),
|
||||
Charset.forName("UTF-8")
|
||||
),
|
||||
ForgeInstallProfile.class
|
||||
);
|
||||
}
|
||||
}
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
package net.kdt.pojavlaunch.installers;
|
||||
|
||||
import android.content.*;
|
||||
import java.io.*;
|
||||
import java.util.jar.*;
|
||||
import net.kdt.pojavlaunch.*;
|
||||
import java.nio.charset.*;
|
||||
import net.kdt.pojavlaunch.value.*;
|
||||
import org.apache.commons.io.*;
|
||||
import com.google.gson.*;
|
||||
import java.util.zip.*;
|
||||
|
||||
public class LegacyOptifineInstaller extends BaseInstaller {
|
||||
public LegacyOptifineInstaller(BaseInstaller i) {
|
||||
from(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int install(JavaGUILauncherActivity ctx) throws IOException {
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package net.kdt.pojavlaunch.installers;
|
||||
|
||||
import java.io.*;
|
||||
import net.kdt.pojavlaunch.*;
|
||||
|
||||
public class NewForgeInstaller extends BaseInstaller
|
||||
{
|
||||
public NewForgeInstaller(BaseInstaller i) {
|
||||
from(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int install(JavaGUILauncherActivity ctx) throws IOException {
|
||||
// Unused ZipFile
|
||||
mJarFile.close();
|
||||
|
||||
ctx.appendlnToLog("Launching JVM");
|
||||
return ctx.launchJavaRuntime(null,
|
||||
"-cp " + Tools.DIR_GAME_NEW + "/config/forge-installer-headless.jar:" + mFile.getAbsolutePath() + " me.xfl03.HeadlessInstaller --installClient .");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user