Disable jar verification by default (#1454)

* Disable jar verification by default

* Delete invalid jars

* Fix?

* Fix?
This commit is contained in:
modmuss
2025-11-24 22:45:02 +00:00
committed by GitHub
parent e612fda6b9
commit 93e3064fac
5 changed files with 16 additions and 3 deletions

View File

@@ -122,7 +122,7 @@ public abstract class MinecraftProvider {
}
private void verifyJars() throws IOException, SignatureVerificationFailure {
if (GradleUtils.getBooleanProperty(getProject(), Constants.Properties.DISABLE_MINECRAFT_VERIFICATION)) {
if (!GradleUtils.getBooleanProperty(getProject(), Constants.Properties.ENABLE_MINECRAFT_VERIFICATION)) {
LOGGER.info("Skipping Minecraft jar verification!");
return;
}

View File

@@ -25,6 +25,7 @@
package net.fabricmc.loom.configuration.providers.minecraft.verify;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Map;
import java.util.function.Function;
@@ -72,6 +73,13 @@ public abstract class MinecraftJarVerification {
}
LOGGER.error("Verification of Minecraft {} signature failed: {}", path.getFileName(), e.getMessage());
try {
Files.delete(path);
} catch (IOException ioe) {
LOGGER.error("Failed to delete invalid Minecraft jar: {}", path, ioe);
}
throw e;
}
}

View File

@@ -159,7 +159,7 @@ public class Constants {
/**
* Skip the signature verification of the Minecraft jar after downloading it.
*/
public static final String DISABLE_MINECRAFT_VERIFICATION = "fabric.loom.disableMinecraftVerification";
public static final String ENABLE_MINECRAFT_VERIFICATION = "fabric.loom.enableMinecraftVerification";
/**
* When using the MojangMappingLayer this will remove names for non root methods by using the intermediary mappings.
*/

View File

@@ -109,7 +109,11 @@ public final class GradleUtils {
}
public static boolean getBooleanProperty(Project project, String key) {
return getBooleanPropertyProvider(project, key).getOrElse(false);
return getBooleanProperty(project, key, false);
}
public static boolean getBooleanProperty(Project project, String key, boolean defaultValue) {
return getBooleanPropertyProvider(project, key).getOrElse(defaultValue);
}
public static Object getProperty(Project project, String key) {

View File

@@ -1,5 +1,6 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
fabric.loom.enableMinecraftVerification=true
# Fabric Properties
# check these on https://fabricmc.net/use