Skip to content

Commit

Permalink
discouraged
Browse files Browse the repository at this point in the history
  • Loading branch information
Matyrobbrt committed Dec 14, 2023
1 parent bf68c98 commit 37ee05f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
spi_version=8.0.7-breaks-clause
spi_version=9.0.6-breaks-clause
mergetool_version=2.0.0
accesstransformers_version=10.0.1
coremods_version=6.0.0
Expand Down
26 changes: 13 additions & 13 deletions loader/src/main/java/net/neoforged/fml/loading/ModSorter.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static LoadingModList sort(List<ModFile> mods, final List<EarlyLoadingExc
}

// If we have conflicts those are considered warnings
if (!resolutionResult.conflicts.isEmpty()) {
if (!resolutionResult.discouraged.isEmpty()) {
list.getWarnings().add(new EarlyLoadingException(
"found mod conflicts",
null,
Expand Down Expand Up @@ -196,17 +196,17 @@ private void detectSystemMods(final Map<String, List<ModFile>> modFilesByFirstId

public record DependencyResolutionResult(
Collection<IModInfo.ModVersion> incompatibilities,
Collection<IModInfo.ModVersion> conflicts,
Collection<IModInfo.ModVersion> discouraged,
Collection<IModInfo.ModVersion> versionResolution,
Map<String, ArtifactVersion> modVersions
) {
public List<EarlyLoadingException.ExceptionData> buildWarningMessages() {
return Stream.concat(conflicts.stream()
.map(mv -> new EarlyLoadingException.ExceptionData("fml.modloading.conflictingmod",
return Stream.concat(discouraged.stream()
.map(mv -> new EarlyLoadingException.ExceptionData("fml.modloading.discouragedmod",
mv.getOwner(), mv.getModId(), mv.getOwner().getModId(), mv.getVersionRange(),
modVersions.get(mv.getModId()), mv.getReason().orElse("fml.modloading.conflictingmod.noreason"))),
modVersions.get(mv.getModId()), mv.getReason().orElse("fml.modloading.discouragedmod.noreason"))),

Stream.of(new EarlyLoadingException.ExceptionData("fml.modloading.conflictingmod.proceed")))
Stream.of(new EarlyLoadingException.ExceptionData("fml.modloading.discouragedmod.proceed")))
.toList();
}

Expand Down Expand Up @@ -254,16 +254,16 @@ private DependencyResolutionResult verifyDependencyVersions()
.filter(ver -> modVersions.containsKey(ver.getModId()) && !this.modVersionNotContained(ver, modVersions))
.collect(toSet());

final var conflictingVersions = modRequirements.stream().filter(ver -> ver.getType() == IModInfo.DependencyType.CONFLICTING)
final var discouragedVersions = modRequirements.stream().filter(ver -> ver.getType() == IModInfo.DependencyType.DISCOURAGED)
.filter(ver -> modVersions.containsKey(ver.getModId()) && !this.modVersionNotContained(ver, modVersions))
.collect(toSet());

if (!conflictingVersions.isEmpty()) {
if (!discouragedVersions.isEmpty()) {
LOGGER.error(
LogMarkers.LOADING,
"Conflicts between mods:\n{}\n\tIssues may arise. Continue at your own risk.",
conflictingVersions.stream()
.map(ver -> formatIncompatibleDependencyError(ver, "conflicting", modVersions))
discouragedVersions.stream()
.map(ver -> formatIncompatibleDependencyError(ver, "discourages", modVersions))
.collect(Collectors.joining("\n"))
);
}
Expand Down Expand Up @@ -294,12 +294,12 @@ private DependencyResolutionResult verifyDependencyVersions()
LogMarkers.LOADING,
"Incompatibilities between mods:\n{}",
incompatibleVersions.stream()
.map(ver -> formatIncompatibleDependencyError(ver, "incompatible", modVersions))
.map(ver -> formatIncompatibleDependencyError(ver, "is incompatible with", modVersions))
.collect(Collectors.joining("\n"))
);
}

return new DependencyResolutionResult(incompatibleVersions, conflictingVersions, missingVersions, modVersions);
return new DependencyResolutionResult(incompatibleVersions, discouragedVersions, missingVersions, modVersions);
}

private static String formatDependencyError(IModInfo.ModVersion dependency, Map<String, ArtifactVersion> modVersions)
Expand All @@ -317,7 +317,7 @@ private static String formatDependencyError(IModInfo.ModVersion dependency, Map<
private static String formatIncompatibleDependencyError(IModInfo.ModVersion dependency, String type, Map<String, ArtifactVersion> modVersions)
{
return String.format(
"\tMod '%s' is %s with: '%s', versions: '%s'; Version found: '%s'",
"\tMod '%s' %s '%s', versions: '%s'; Version found: '%s'",
dependency.getOwner().getModId(),
type,
dependency.getModId(),
Expand Down

0 comments on commit 37ee05f

Please sign in to comment.