From 3d142df1024df893a5fb180991bfef997f664e20 Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 16 Apr 2013 13:44:50 -0400 Subject: [PATCH] Use more expressive language when a version specifier is a simple unbounded above condition --- fml/client/cpw/mods/fml/client/GuiModsMissing.java | 12 +++++++++++- .../common/versioning/DefaultArtifactVersion.java | 7 ++++++- .../mods/fml/common/versioning/VersionRange.java | 13 ++++++++++++- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/fml/client/cpw/mods/fml/client/GuiModsMissing.java b/fml/client/cpw/mods/fml/client/GuiModsMissing.java index 9a17b8ad75..0597ebb94d 100644 --- a/fml/client/cpw/mods/fml/client/GuiModsMissing.java +++ b/fml/client/cpw/mods/fml/client/GuiModsMissing.java @@ -5,7 +5,7 @@ * are made available under the terms of the GNU Lesser Public License v2.1 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * + * * Contributors: * cpw - implementation */ @@ -15,6 +15,7 @@ package cpw.mods.fml.client; import net.minecraft.client.gui.GuiErrorScreen; import cpw.mods.fml.common.MissingModsException; import cpw.mods.fml.common.versioning.ArtifactVersion; +import cpw.mods.fml.common.versioning.DefaultArtifactVersion; public class GuiModsMissing extends GuiErrorScreen { @@ -43,6 +44,15 @@ public class GuiModsMissing extends GuiErrorScreen for (ArtifactVersion v : modsMissing.missingMods) { offset+=10; + if (v instanceof DefaultArtifactVersion) + { + DefaultArtifactVersion dav = (DefaultArtifactVersion)v; + if (dav.getRange() != null && dav.getRange().isUnboundedAbove()) + { + this.func_73732_a(this.field_73886_k, String.format("%s : minimum version required is %s", v.getLabel(), dav.getRange().getLowerBoundString()), this.field_73880_f / 2, offset, 0xEEEEEE); + continue; + } + } this.func_73732_a(this.field_73886_k, String.format("%s : %s", v.getLabel(), v.getRangeString()), this.field_73880_f / 2, offset, 0xEEEEEE); } offset+=20; diff --git a/fml/common/cpw/mods/fml/common/versioning/DefaultArtifactVersion.java b/fml/common/cpw/mods/fml/common/versioning/DefaultArtifactVersion.java index cfd574437d..b34a29a48a 100644 --- a/fml/common/cpw/mods/fml/common/versioning/DefaultArtifactVersion.java +++ b/fml/common/cpw/mods/fml/common/versioning/DefaultArtifactVersion.java @@ -5,7 +5,7 @@ * are made available under the terms of the GNU Lesser Public License v2.1 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * + * * Contributors: * cpw - implementation */ @@ -98,4 +98,9 @@ public class DefaultArtifactVersion implements ArtifactVersion { return label == null ? comparableVersion.toString() : label + ( unbounded ? "" : "@" + range); } + + public VersionRange getRange() + { + return range; + } } diff --git a/fml/common/cpw/mods/fml/common/versioning/VersionRange.java b/fml/common/cpw/mods/fml/common/versioning/VersionRange.java index 0204503661..bd8f0df950 100644 --- a/fml/common/cpw/mods/fml/common/versioning/VersionRange.java +++ b/fml/common/cpw/mods/fml/common/versioning/VersionRange.java @@ -5,7 +5,7 @@ * are made available under the terms of the GNU Lesser Public License v2.1 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * + * * Contributors: * cpw - implementation */ @@ -549,4 +549,15 @@ public class VersionRange hash = 31 * hash + ( restrictions == null ? 0 : restrictions.hashCode() ); return hash; } + + public boolean isUnboundedAbove() + { + return restrictions.size() == 1 && restrictions.get(0).getUpperBound() == null && !restrictions.get(0).isUpperBoundInclusive(); + } + + public String getLowerBoundString() + { + return restrictions.size() == 1 ? restrictions.get(0).getLowerBound().getVersionString() : ""; + } + }