Skip to content

Commit

Permalink
Use latest LVT compat if no loader dependency is declared
Browse files Browse the repository at this point in the history
Fixes #803
  • Loading branch information
Su5eD committed Feb 5, 2024
1 parent a3acabc commit 56ff2d4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=true

# Versions
versionConnector=1.0.0-beta.36
versionConnector=1.0.0-beta.37
versionAdapter=1.11.19-1.20.1-20240126.215012
versionAdapterDefinition=1.11.24

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,26 @@ public static int getMixinCompat(ModMetadata metadata) {
// infer from loader dependency by determining the least relevant loader version the mod accepts
// AND any loader deps

boolean found = false;
List<VersionInterval> reqIntervals = List.of(VersionInterval.INFINITE);

for (ModDependency dep : metadata.getDependencies()) {
if (dep.getModId().equals("fabricloader") || dep.getModId().equals("fabric-loader")) {
if (dep.getKind() == ModDependency.Kind.DEPENDS) {
found = true;
reqIntervals = VersionInterval.and(reqIntervals, dep.getVersionIntervals());
}
else if (dep.getKind() == ModDependency.Kind.BREAKS) {
found = true;
reqIntervals = VersionInterval.and(reqIntervals, VersionInterval.not(dep.getVersionIntervals()));
}
}
}

if (!found) {
return FabricUtil.COMPATIBILITY_0_10_0;
}

if (reqIntervals.isEmpty()) throw new IllegalStateException("mod " + metadata.getId() + " is incompatible with every loader version?"); // shouldn't get there

Version minLoaderVersion = reqIntervals.get(0).getMin(); // it is sorted, to 0 has the absolute lower bound
Expand Down

0 comments on commit 56ff2d4

Please sign in to comment.