-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
129 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip | ||
networkTimeout=10000 | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/main/java/org/sinytra/connector/locator/MixinTransformSafeguard.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package org.sinytra.connector.locator; | ||
|
||
import com.mojang.logging.LogUtils; | ||
import net.neoforged.fml.ModLoadingException; | ||
import net.neoforged.fml.ModLoadingIssue; | ||
import net.neoforged.fml.loading.progress.StartupNotificationManager; | ||
import org.sinytra.adapter.patch.api.PatchAuditTrail; | ||
import org.sinytra.connector.transformer.jar.JarTransformer; | ||
import org.sinytra.connector.util.ConnectorConfig; | ||
import org.slf4j.Logger; | ||
|
||
import java.util.List; | ||
|
||
public final class MixinTransformSafeguard { | ||
private static final Logger LOGGER = LogUtils.getLogger(); | ||
|
||
public static boolean isEnabled() { | ||
return ConnectorConfig.INSTANCE.get().enableMixinSafeguard(); | ||
} | ||
|
||
public static void trigger(List<JarTransformer.TransformedFabricModPath> failing) throws ModLoadingException { | ||
if (!isEnabled()) { | ||
LOGGER.warn("Ignoring {} found incompatibilities as mixin safeguard is disabled", failing.size()); | ||
return; | ||
} | ||
|
||
StartupNotificationManager.addModMessage("INCOMPATIBLE FABRIC MOD FOUND"); | ||
StringBuilder builder = new StringBuilder(); | ||
|
||
String msg = "Found §e" + failing.size() + " incompatible Fabric " + (failing.size() > 1 ? "mods" : "mod") + "§r. Details are provided below.\n\n" + | ||
"With the current configuration, Connector §ccannot guarantee§r a stable environment. Should you still want to proceed, please restart the game.\n\n" + | ||
"§7This one-time safety check can be disabled in Connector's config file under \"enableMixinSafeguard\".§r"; | ||
builder.append(msg).append("\n\n"); | ||
|
||
failing.forEach(p -> { | ||
builder.append("Mod file §e").append(p.input().getFileName().toString()).append("§r has failing mixins:\n"); | ||
for (PatchAuditTrail.Candidate failed : p.auditTrail().getFailingMixins()) { | ||
String[] parts = failed.classNode().name.split("/"); | ||
builder.append("- §c").append(parts[parts.length - 1]).append("§7#§3").append(failed.methodNode().name).append("§r\n"); | ||
} | ||
builder.append("\n"); | ||
}); | ||
|
||
throw new ModLoadingException(ModLoadingIssue.error(builder.toString())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.