fix: 1.6.4 crash

i hate forge
This commit is contained in:
alexytomi
2025-10-07 14:27:05 +08:00
parent dee57ef9fc
commit eb0bab0b83
3 changed files with 29 additions and 17 deletions

View File

@@ -390,24 +390,29 @@ public class MainActivity extends BaseActivity implements ControlButtonMenuListe
private void runCraft(String versionId, JMinecraftVersionList.Version version) throws Throwable {
String assetVersion;
if (version.inheritsFrom != null) { // We are almost definitely modded if this runs
File vanillaJsonFile = new File(Tools.DIR_HOME_VERSION + "/" + version.inheritsFrom + "/" + version.inheritsFrom + ".json");
JMinecraftVersionList.Version vanillaJson;
try { // Get the vanilla json from modded instance
vanillaJson = Tools.GLOBAL_GSON.fromJson(Tools.read(vanillaJsonFile.getAbsolutePath()), JMinecraftVersionList.Version.class);
} catch (IOException ignored) { // Should never happen, we check for this in MinecraftDownloader().start()
throw new RuntimeException(getString(R.string.error_vanilla_json_corrupt));
try {
if (version.inheritsFrom != null) { // We are almost definitely modded if this runs
File vanillaJsonFile = new File(Tools.DIR_HOME_VERSION + "/" + version.inheritsFrom + "/" + version.inheritsFrom + ".json");
JMinecraftVersionList.Version vanillaJson;
try { // Get the vanilla json from modded instance
vanillaJson = Tools.GLOBAL_GSON.fromJson(Tools.read(vanillaJsonFile.getAbsolutePath()), JMinecraftVersionList.Version.class);
} catch (IOException ignored) { // Should never happen, we check for this in MinecraftDownloader().start()
throw new RuntimeException(getString(R.string.error_vanilla_json_corrupt));
}
// Something went wrong if this is somehow not the case anymore
if (!Objects.equals(vanillaJson.assets, vanillaJson.assetIndex.id))
Tools.showErrorRemote(new RuntimeException(getString(R.string.error_vanilla_json_corrupt)));
assetVersion = vanillaJson.assets;
} else {
// Else assume we are vanilla
if (!Objects.equals(version.assets, version.assetIndex.id))
Tools.showErrorRemote(new RuntimeException(getString(R.string.error_vanilla_json_corrupt)));
assetVersion = version.assets;
}
// Something went wrong if this is somehow not the case anymore
if (!Objects.equals(vanillaJson.assets, vanillaJson.assetIndex.id))
Tools.showErrorRemote(new RuntimeException(getString(R.string.error_vanilla_json_corrupt)));
assetVersion = vanillaJson.assets;
} else {
// Else assume we are vanilla
if (!Objects.equals(version.assets, version.assetIndex.id))
Tools.showErrorRemote(new RuntimeException(getString(R.string.error_vanilla_json_corrupt)));
assetVersion = version.assets;
}
} catch (RuntimeException ignored){
runOnUiThread(() -> Toast.makeText(this, R.string.autorendererselectfailed, Toast.LENGTH_LONG).show());
assetVersion = "legacy";
} // If this fails.. oh well.
// Autoselect renderer
if (Tools.LOCAL_RENDERER == null) {
// 25w09a is when HolyGL4ES starts showing a black screen upon world load.

View File

@@ -374,6 +374,12 @@ public final class Tools {
// Legacy Fabric needs this to be first or else it uses the wrong lwjgl
} else javaArgList.add(getLWJGL3ClassPath() + ":" + launchClassPath);
// Forge 1.6.4 crash mitigation
// https://github.com/MinecraftForge/FML/blob/f1b3381e61fac1a0ae90f521223c6bc613eb4888/common/cpw/mods/fml/common/asm/FMLSanityChecker.java#L192-L208
// It for some reason fails certification and crashes because it thinks Minecraft is corrupted.
// This also has no loading screen as a result.
javaArgList.add("-Dfml.ignoreInvalidMinecraftCertificates=true");
javaArgList.add(versionInfo.mainClass);
javaArgList.addAll(Arrays.asList(launchArgs));
// ctx.appendlnToLog("full args: "+javaArgList.toString());

View File

@@ -482,4 +482,5 @@
<string name="oldL4JFound">You are using a version of Legacy4J without the android fixes! You will need to manually enable SDL in the controller settings to get the best experience!</string>
<string name="global_warning">Warning!</string>
<string name="controllableFound">Controllable currently has a random chance of crashing on launch. Either keep trying again and hope it launches or use another mod like Controlify.</string>
<string name="autorendererselectfailed">Auto-renderer select failed, defaulting to HolyGL4ES</string>
</resources>