mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-26 15:03:04 +00:00
Try and be a bit nicer about handling bad [feature] definitions (#9606)
* Try and be a bit nicer about handling bad [feature] definitions - they're single square bracket defined and require strings for feature bound values. * Some more tweaks to the feature system to output useful and well formatted error messages when bounds fail. Requires SPI 7.0.1 and the language string "fml.modloading.feature.missing" has changed. * Use immutable lists where possible and generally tidy things a bit
This commit is contained in:
12 files changed
+105
-60
No files matched your search
@@ -6,6 +6,7 @@
|
||||
package net.minecraftforge.common.util;
|
||||
|
||||
import net.minecraftforge.common.ForgeI18n;
|
||||
import net.minecraftforge.forgespi.locating.ForgeFeature;
|
||||
import org.apache.maven.artifact.versioning.ArtifactVersion;
|
||||
import org.apache.maven.artifact.versioning.Restriction;
|
||||
import org.apache.maven.artifact.versioning.VersionRange;
|
||||
@@ -80,4 +81,17 @@ public class MavenVersionStringHelper {
|
||||
public static void parseVersionRange(final StringBuffer stringBuffer, final Object range) {
|
||||
stringBuffer.append(versionRangeToString((VersionRange) range));
|
||||
}
|
||||
|
||||
public static void parseFeatureBoundValue(final StringBuffer stringBuffer, final Object range) {
|
||||
if (range instanceof ForgeFeature.Bound bound) {
|
||||
stringBuffer.append(bound.featureName());
|
||||
if (bound.bound() instanceof Boolean b) {
|
||||
stringBuffer.append("=").append(b);
|
||||
} else if (bound.bound() instanceof VersionRange vr) {
|
||||
stringBuffer.append(" ").append(versionRangeToString(vr));
|
||||
} else {
|
||||
stringBuffer.append("=\"").append(bound.featureBound()).append("\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user