mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-04-01 21:17:46 -05:00
Force forge mod detection
This commit is contained in:
@@ -73,7 +73,7 @@ public class ModCompileRemapper {
|
||||
String version = artifact.getModuleVersion().getId().getVersion();
|
||||
String classifierSuffix = artifact.getClassifier() == null ? "" : (":" + artifact.getClassifier());
|
||||
|
||||
if (!shouldRemapMod(logger, artifact, extension.isForge())) {
|
||||
if (!shouldRemapMod(logger, artifact, extension.isForge(), sourceConfig.getName())) {
|
||||
addToRegularCompile(project, regularConfig, artifact);
|
||||
continue;
|
||||
}
|
||||
@@ -88,7 +88,7 @@ public class ModCompileRemapper {
|
||||
|
||||
modDependencies.add(info);
|
||||
|
||||
String remappedLog = group + ":" + name + ":" + version + classifierSuffix + " (" + mappingsSuffix + ")";
|
||||
String remappedLog = group + ":" + name + ":" + version + classifierSuffix + " (" + mappingsSuffix + ")" + (info.requiresRemapping() ? " requires remapping" : " already remapped in " + info.getRemappedOutput().getAbsolutePath());
|
||||
project.getLogger().info(":providing " + remappedLog);
|
||||
|
||||
if (sources != null) {
|
||||
@@ -104,6 +104,7 @@ public class ModCompileRemapper {
|
||||
|
||||
// Add all of the remapped mods onto the config
|
||||
for (ModDependencyInfo info : modDependencies) {
|
||||
project.getLogger().info(":adding " + info.toString() + " into " + info.targetConfig.getName());
|
||||
project.getDependencies().add(info.targetConfig.getName(), project.getDependencies().module(info.getRemappedNotation()));
|
||||
}
|
||||
}
|
||||
@@ -112,18 +113,20 @@ public class ModCompileRemapper {
|
||||
/**
|
||||
* Checks if an artifact is a fabric mod, according to the presence of a fabric.mod.json.
|
||||
*/
|
||||
private static boolean shouldRemapMod(Logger logger, ResolvedArtifact artifact, boolean forge) {
|
||||
private static boolean shouldRemapMod(Logger logger, ResolvedArtifact artifact, boolean forge, String config) {
|
||||
File input = artifact.getFile();
|
||||
|
||||
try (ZipFile zipFile = new ZipFile(input)) {
|
||||
if (forge) {
|
||||
if (zipFile.getEntry("META-INF/mods.toml") != null) {
|
||||
logger.info("Found Forge mod in modCompile: {}", artifact.getId());
|
||||
logger.info("Found Forge mod in " + config + ": {}", artifact.getId());
|
||||
return true;
|
||||
}
|
||||
logger.lifecycle(":could not find forge mod in " + config + " but forcing: {}", artifact.getId());
|
||||
return true;
|
||||
} else {
|
||||
if (zipFile.getEntry("fabric.mod.json") != null) {
|
||||
logger.info("Found Fabric mod in modCompile: {}", artifact.getId());
|
||||
logger.info("Found Fabric mod in " + config + ": {}", artifact.getId());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user